bonsai-ninja AGENTS.md

bonsai-ninja AGENTS.md is an instructions file for Codex, OpenCode from gromhacks/bonsai-ninja. It costs 6,007 tokens per session, scanned A, original, MIT.

Repository instructions for bonsai-ninja, a code-analysis tool that maps source code, finds symbols, traces behavior and data flow, and runs security checks.

In plain words
What is it for?
Mapping a codebase, investigating how code works, debugging data flow, running static security analysis, and keeping an index updated while files change.
Why use it?
They tell an coding agent which commands and options to use, helping it get reliable, readable results from the tool.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/gromhacks/bonsai-ninja/agents-md
Clone the repo
git clone --depth 1 https://github.com/gromhacks/bonsai-ninja

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bonsai-ninja AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/gromhacks/bonsai-ninja/agents-md.svg)](https://agentmods.dev/instructions/gromhacks/bonsai-ninja/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/gromhacks/bonsai-ninja/agents-md"><img src="https://agentmods.dev/badge/instructions/gromhacks/bonsai-ninja/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 6,007 This file is loaded in full into every session.
When invoked 6,007 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.06007 $0.06007
Opus 5 $0.03003 $0.03003
Sonnet 5 $0.01201 $0.01201
Haiku 4.5 $0.00601 $0.00601

Measured today against content hash bad9990f9648, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

bonsai-ninja AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 446 lines

How it starts

The opening of the file, as written. The whole thing — 446 lines — stays where its author put it; the contents beside it link to each section on GitHub.

bonsai-ninja

Use bonsai-ninja when you need structural code intelligence: map a repo, find symbols, trace behavior, debug dataflow, or run SAST.

Command truth comes from the binary:

./target/release/bonsai-ninja --help
./target/release/bonsai-ninja <command> --help
./target/release/bonsai-ninja security --help

Prefer ./target/release/bonsai-ninja; use debug only if release is missing. For scripts use --format json --no-color --no-progress; add --all or --context uncapped only for intentional exhaustive artifacts. For LLM-readable text use --no-color --no-progress --context 16k. Keep the workspace positional and prefer explicit selector flags (--query, --symbol, --file, --from, --to, --id) in scripts and agent calls. Positional selectors remain supported for interactive use, but the CLI rejects supplying both forms. Output files accept -o, --output, and --output-path. Use --html-output <file> for a standalone themed human report rendered from the command's canonical JSON result (the same document --format json prints); it must never enable additional analysis and is mutually exclusive with --output-path. For save-time workflows, keep index <workspace> --watch --no-progress running; command and SDK facades refresh saved file changes before they render. index <workspace> is the syntax/construct warm-up path: it parses source and builds declaration/import indexes without forcing a whole-workspace semantic prewarm. Use index <workspace> --semantic only when you intentionally want structural semantic sidecars and the external workspace-cache manifest.json built up front; commands still validate sidecar headers/payloads before reuse and compute requested exact facts on demand. Retrieval is candidate lookup only: search and literal-filtered browse can reuse a fresh sidecar before candidate lookup, and large-workspace inspect-graph can use a warmed sidecar only before opening a scoped workspace. Rendered facts still hydrate through canonical APIs, and scoped query workspaces do not publish partial retrieval sidecars under the full workspace cache.

Analysis sidecars live in a canonical-path-keyed OS cache directory, not in the inspected repository; cache stats <workspace> reports it and BONSAI_WORKSPACE_DIR overrides it. The cache root carries a locked canonical workspace binding so dependency-manifest freshness cannot be lost when a sidecar path is outside the source tree. Workspace-local rule overlays remain under <workspace>/.bonsai/rules/ and are not analysis caches.

Treat the analyzer as a compiler pipeline. Each language adapter owns its Tree-sitter grammar, source-syntax recognition, declaration/import lowering, literal/value node inventories, and FlowEvent/capability facts. Shared analysis consumes that typed IR; do not add language-id branches, cross-language token inventories, or API-name guesses to shared crates. Library/package/framework identities and every security-sensitive value belong in security-patterns/langs/<lang>, not in shared analysis or an adapter; adapters emit generic syntax/capability facts and rule data assigns their security meaning. Pack-wide package spelling, review profiles, test-path policy, dependency metadata, and taxonomy live in security-patterns/metadata.yml. The production taint engine is the sparse IDG fixed-point closure. It has no BFS name search, call-depth ceiling, iteration limit, or result cap. Paging and diagnostic path limits affect rendering only and must report truncation explicitly.

index --semantic first publishes an immutable content-addressed generation of per-file compiler objects. Each object is exact adapter-lowered IR plus diagnostics, validated by path, adapter, frontend ABI, and SHA-256 source content. Import indexes, direct-call receiver-field initializer linkage, and compact syntax-target facts (calls, assignment aliases, factory assignments, inline callbacks, exact assignment/return/call-argument value shapes, typed callables, and receiver/type evidence) are integrity-checked compiler headers inside the same generation and must remain independently decodable from declaration/flow bodies. Broad rule planning filters raw source anchors, exact import/package headers, and exact syntax targets in that order before decoding a surviving body. Later phases stream those objects; they must not reparse source or invent a parallel lowering path. Rulepack return typing retains its declared imports; exact workspace values and ordinary functions shadow external kind: new models, and mixed or ambiguous callable identities fail closed. Every derived semantic pipeline identity includes the compiler-object frontend ABI; a lowering change invalidates older callgraph/IDG sidecars even when source bytes are unchanged, and root-only validators reconstruct the same identity as a full workspace open. Persisted IDG construction lowers transfer facts once, spools typed stitch records/node maps, and replays them per segment. Independent transfer segments lower continuously on bounded dedicated workers under exact source-size memory permits. Completed output retains its permit until a bounded reorder map publishes canonical ascending SegmentId order to the serial stitcher. Do not reintroduce per-batch barriers, and do not accept an earlier phase-local speedup without measuring its allocator/RSS effect on the complete cold pipeline. Memory scheduling may weight or serialize units, but must never cap semantic work. After the isolated workers finish, the parent validates that every sidecar describes one current workspace snapshot and reruns the exact sequence if a file changed between phases. All parser, compiler-object, IDG transfer, summary, accelerator, and matcher workers use the shared named compiler-thread stack contract; never launch source-IR work on an unnamed platform-default stack. Generic nested flow-event visitation uses an explicit heap worklist, and the ordinary gate must retain the deep Java semantic-build and deep typed-IDG lowering regressions.

Read the full file on GitHub · 446 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today Changed · -1 lines · -64 tokens per session bad9990f9648
  2. yesterday Changed · +17 lines · +230 tokens per session f7d82885bfa6
  3. 6d ago First seen · 430 lines · 5,841 tokens per session scan A da9f0fa7ab5e

Subscribe to this mod's changes

bonsai-ninja AGENTS.md is an instructions file published in the GitHub repository gromhacks/bonsai-ninja (22 stars, last pushed today), licensed MIT. It adds 6,007 tokens to every session, about $0.0300 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.