kitaru / devtools
AGENTS.md324 starsChanged 2 days agoApache-2.0View on GitHub
Local harness for running Kitaru end to end: servers, databases, workers, deterministic sessions, and evaluations. Reach for it when a change needs a live stack or realistic data. Unit tests under tests/ cover ordinary changes, so do not start a stack to verify something a test can prove. Everything is deterministic. The same seed and flags produce the same sessions, the same tool calls, and the same failures, so a replay of an imported trace hits the recorded baseline. Requires…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- plugins/AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- docker/CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- kitaru-adapter-developmentSkill
- kitaru-devSkill
- kitaru-docsSkill
- kitaru-importer-developmentSkill
- kitaru-releaseSkill
- kitaru-tests-releaseSkill
- kitaru-ui-api-developmentSkill
- kitaru-adapter-developmentSkill
- kitaru-devSkill
- kitaru-docsSkill
- kitaru-importer-developmentSkill
- kitaru-releaseSkill
- kitaru-tests-releaseSkill
- kitaru-ui-api-developmentSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Always pass an explicit --db-name that no one else would pick.
- Distinctive: line 110
Read the numbers before reporting them.
- Very specific: line 116
Stop the servers and workers you started, by pid when stack.py down does not know about them.
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Devtools rules
Local harness for running Kitaru end to end: servers, databases, workers, deterministic sessions, and evaluations. Reach for it when a change needs a live stack or realistic data. Unit tests under tests/ cover ordinary changes, so do not start a stack to verify something a test can prove.
Everything is deterministic. The same seed and flags produce the same sessions, the same tool calls, and the same failures, so a replay of an imported trace hits the recorded baseline.
| File | Use it for |
stack.py | Server, database, and worker lifecycle |
seed.py | One-command end-to-end stack with data |
traces.py | Generate JSONL traces to import |
agent.py | Dummy agent, runs as a worker task or records directly |
fixtures.py | Register the agent, importer, and evaluators |
evaluators.py | Evaluator plugin, one entrypoint per result shape |
importer.py | JSONL importer plugin with failure modes |
overview.py | Read-only dashboard of a running server |
load.py | Concurrent load with latency percentiles |
dbstats.py | Postgres and query statistics, lock sampling |
resilience.py | Worker crash, zombie, fleet-death, abandonment scenarios |
simulation.py | Shared simulation core, do not invoke directly |
check_mastra_memory_replay.py | Prove SDK, CLI, and MCP Mastra memory replay on a disposable stack |
check_mastra_processor_decisions.py | Prove Mastra decision recording and replay on a local worker |
check_typescript_evaluators.py | Check the TypeScript evaluator bridge through a disposable worker stack |
check_importer_sdks.py | Smoke-test trace importer SDKs against local MLflow/Phoenix servers and live or stub cloud APIs |
publish.sh | Build and push dev images and chart, create a ZenML Pro workspace |
Requires uv sync --extra server and Docker for Postgres. Add --extra cli when you shell out to kitaru. check_importer_sdks.py runs from the plugins workspace instead (uv run --project plugins --no-sync python devtools/check_importer_sdks.py), uses Docker for Arize Phoenix and uvx for MLflow, and uses live read-only cloud probes when LANGFUSE_*, LOGFIRE_READ_TOKEN, or BRAINTRUST_API_KEY + BRAINTRUST_PROJECT_ID are set (pass --require-live to forbid local stub fallbacks).
The .mjs agent scripts are type-checked against the built packages by devtools/tsconfig.json, which pnpm run typecheck runs after it builds them. To check them alone, run pnpm run build:packages, then pnpm exec tsc -p devtools/tsconfig.json.
Isolate your stack
devtools/.run/server.json holds exactly one server record. A second stack.py up overwrites it, and stack.py down and status then target the wrong server. Another agent or a background session may already own it.
Always pass an explicit --db-name that no one else would pick. Never assume the recorded stack is yours: check stack.py status and git worktree list before acting on it.
seed.py --keep starts a server without recording it at all, so stack.py down cannot stop it. Keep the printed pid and port, and kill it yourself.
Getting a stack
uv run python devtools/stack.py up --db-name kitaru_<yourtask> --fresh
uv run python devtools/stack.py workers --count 2Jobs (imports, session runs, experiments) need a running worker. For a pending job, first check worker availability and eligibility; if a suitable worker is active, inspect claim and dispatch failures.
--auth local prints an API key export, the default is none. --env KEY=VALUE passes server settings. --docker runs from docker-compose.yml instead.
For a full stack with data in one command:
uv run python devtools/seed.py --sessions 50 --db-name kitaru_<yourtask> --keepThat imports generated traces, records live sessions, builds a cohort, runs an experiment with a model override and a baseline history tool policy, evaluates the results, and prints a pass/fail check summary. Treat a [FAIL] line as the signal, not the prose above it. --base-url targets a running server instead of starting one, and needs KITARU_API_KEY exported when that server authenticates.
Resetting instead of reseeding
Seeding is slow, snapshots are not. Seed once, then snapshot, then restore whenever a test trashed the data:
uv run python devtools/stack.py db snapshot kitaru_snap_<what>
uv run python devtools/stack.py db restore kitaru_snap_<what>Both default to the running stack's database and take about a second. They terminate active connections, and the server's pool reconnects on the next request. A snapshot is a database, not a file, so name it kitaru_snap_* to keep db list and db clean --prefix useful.
Exact command forms
--importer and --agent take NAME@VERSION. A bare name is rejected:
uv run kitaru session import traces.jsonl --importer 'dummy-jsonl@1' --agent 'dummy-agent@1' --waitdummy-jsonl is a script plugin registered by fixtures.py and works offline. The built-in kitaru/kitaru-jsonl@1 installs its package from PyPI at task time and only accepts well-formed input. Use dummy-jsonl unless you are specifically testing the built-in.
traces.py --malformed N caps at the number of canned broken lines. Asking for more is clamped, not an error.
dbstats.py --db-name defaults to the running stack's database. dbstats.py enable restarts the Postgres container to preload pg_stat_statements, which interrupts every other stack on that container.
Injecting failures
Failures are decided from a hash of the inputs, so a given input either always fails or never does. Do not retry expecting a different outcome, change the inputs or the rate.
- Agent, via environment (bake in with
fixtures.py --agent-env KEY=VALUE --display-version NAME):DUMMY_AGENT_FAILURE_RATEfails sessions through the simulated model,DUMMY_AGENT_CRASH_RATEkills the process before finalization and leaves the session in progress,DUMMY_AGENT_CRASH_BEFORE_SESSION_RATEkills it before the session exists,DUMMY_AGENT_SLEEP_SECONDSdelays every task. - Evaluators, via
EvaluatorConfig.params:failure_rateraises for a fraction of sessions,sleep_msdelays every evaluation. - Importer
dummy-jsonl, via import params:fail_line_rateturns valid lines into import failures,sleep_ms_per_lineslows parsing,crashfails the whole task. traces.py --failure-rateproduces sessions that completed with a failed status,--malformedproduces lines the importer must reject.
Replay coverage
agent.py honors ReplayOverride.model (string or mapping), ReplayOverride.model_params, and ReplayOverride.prompt, plus tool policies passthrough, static (exact and subset case matching), and history (all scopes, with baseline occurrence tracking) with every on_miss behavior. The llm policy is rejected on purpose.
A prompt override changes tool inputs by reseeding the per-session RNG, so whether it forces a history miss depends on the baseline. Verify the miss actually happened before concluding an on_miss path works. No generated session calls the same tool twice with identical inputs, so occurrence identity needs hand-built baseline nodes.
Inspecting and measuring
uv run python devtools/overview.py # agents, sessions, jobs, evaluations, cohorts, experiments
uv run python devtools/load.py --duration 30 --concurrency 10 --write-rate 0.1
uv run python devtools/dbstats.py report # sizes, scans, index diagnostics, top queries
uv run python devtools/dbstats.py sample --seconds 30 # lock waits during a workload
uv run python devtools/resilience.py # worker recovery scenariosoverview.py takes section names to print a subset. load.py --write-rate needs registered fixtures. resilience.py --db-name BASE gives each scenario a stable BASE_<scenario> database and keeps it, otherwise databases are random and only failed ones survive. Logs land under devtools/.run/, which is gitignored.
Read the numbers before reporting them. Latency that grows with concurrency while throughput stays flat is saturation, not regression, and a single-process server saturates on CPU well before Postgres does.
Clean up
Leaving stacks and databases behind breaks the next agent. Before you finish:
- Stop the servers and workers you started, by pid when
stack.py downdoes not know about them. - Drop the databases you created, and only those. Never drop one you did not create.
stack.py db listshows everykitaru*database,db clean --prefixremoves a family.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

