agentleFS
okandemirelokandemirel/Strada.Brain/AGENTS.md

Strada.Brain

AGENTS.md28 starsChanged 25 days agoMITView on GitHub

AI-powered Unity development assistant for Strada.Core framework projects. It is multi-channel (Web, Telegram, Discord, Slack, CLI, Teams) and multi-provider, with autonomous learning and memory. Every agent session loads this file: Claude Code reaches it through CLAUDE.md, and Codex reads it directly. So it is a router. It holds pointers and the few rules that are cheap to state and expensive to miss. The rules themselves live in docs/contracts/README.md. Open the contract for an area before you change code in it.

  • Reads credentials
  • Installs packages

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

23 rules. About 1 is common, 11 are distinctive, and 11 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    When config.vault.enabled=true, prefer vault_search over repeated Read/Grep cycles.

    line 40
  2. Very specific:

    Use vault_init, vault_sync and vault_status to attach, reindex and check a vault.

    line 41
  3. Distinctive:

    Read only that card's entrypoints and contracts.

    line 47
  4. Very specific:

    Search the whole repo only when the map missed.

    line 49
  5. Very specific:

    Path containment: never hand-roll "is X inside Y".

    line 55
  6. Very specific:

    ESM: no bare require( in src. Inside a try/catch it is a silent false at run time, and the tests cannot see it.

    line 56
  7. Very specific:

    Tests: never make a check pass by weakening its test — no removed case or assertion, new skip, commented-out test, or loosened pin without …

    line 58
  8. Very specific:

    File size: no source file grows past 1,000 lines, and the 64 that already have may not grow at all.

    line 59
  9. Distinctive:

    When a request matches, load the skill file and follow it in full.

    line 74
  10. Distinctive:

    Prefer functional patterns.

    line 88
  11. Distinctive:

    Keep functions focused, under ~50 lines where possible.

    line 90
  12. Distinctive:

    Every public function handles its errors.

    line 91
  13. Very specific:

    Never commit .env, credentials or secrets.

    line 96
  14. Distinctive:

    Never amend a commit that is already pushed: CI's Version Bump workflow fails on the rewritten sha.

    line 97
  15. Common:

    Never hardcode API keys, secrets or credentials.

    line 101
  16. Very specific:

    Do NOT modify node_modules/ or generated dist/ files.

    line 109
  17. Distinctive:

    Do NOT create files in the project root.

    line 110
  18. Very specific:

    Do NOT modify test infrastructure (scripts/run-vitest-batches.mjs).

    line 111
  19. Distinctive:

    Do NOT add new npm dependencies.

    line 112
  20. Distinctive:

    Do NOT skip or disable existing tests to make new code pass.

    line 113
  21. Very specific:

    Do NOT name, quote or commit material from any external project Strada.Brain was run against.

    line 114
  22. Distinctive:

    Every session loads this file, so keep it a router and not a reference.

    line 123
  23. Distinctive:

    Never copy a contract's text, table or example here.

    line 126

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Strada.Brain

AI-powered Unity development assistant for Strada.Core framework projects. It is multi-channel (Web, Telegram, Discord, Slack, CLI, Teams) and multi-provider, with autonomous learning and memory.

Every agent session loads this file: Claude Code reaches it through CLAUDE.md, and Codex reads it directly. So it is a router. It holds pointers and the few rules that are cheap to state and expensive to miss. The rules themselves live in docs/contracts/README.md. Open the contract for an area before you change code in it.

Build & Test

npm install                # Install dependencies
npm run bootstrap          # Install + build web portal
npm run dev                # Development mode (tsx watch)
npm test                   # Run all tests (batched vitest)
npm run test:portal        # Run web portal tests
npm run doctor             # Diagnose setup issues
  • Node.js 20+, ESM ("type": "module"), TypeScript strict mode, Zod for config validation.
  • Tests run on Vitest, batched by scripts/run-vitest-batches.mjs. The web portal (React + Vite, its own package.json) is in web-portal/ and builds to src/channels/web/static/.

Where things are

  • Repo map, one card per src/ module: docs/architecture/repo_map.yaml. Its depends_on comes from the imports (node scripts/repo-map-doctor.mjs --write), never from a hand edit.
  • Contracts, the rule index with a "read when" column: docs/contracts/README.md.
  • Entry point: src/index.ts (Commander CLI), which calls src/core/bootstrap.ts. Bootstrap delegates to its bootstrap-* stages.
  • Agent loop: src/agents/. The orchestrator runs Plan → Act → Observe → Reflect and delegates to focused helper modules. Shared agent code is in src/agent-core/. Subsystems talk over the TypedEventBus.
  • Campaigns ("GDD in → finished game out"): src/campaign/.
  • Goal DAG planning: src/goals/. The planner's rules are in goal-decomposer.ts.
  • Conformance gates (the [STRADA …] refusals): src/agents/autonomy/strada-conformance.ts. The worker's framework knowledge is in src/agents/context/strada-knowledge.ts.
  • Other subsystems:
    • channels: src/channels/{web,telegram,discord,slack,cli,teams}/
    • config (Zod, 90+ env vars): src/config/
    • memory (AgentDB, SQLite + HNSW): src/memory/
    • learning: src/learning/
    • local asset generation: src/assets-local/
    • security: src/security/
    • dashboard: src/dashboard/
  • Shared helpers: src/common/, src/utils/. Look there before you write a helper. A second copy of a helper is how the path-containment contract started.
  • Codebase Memory Vault: docs/vault.md.
    • When config.vault.enabled=true, prefer vault_search over repeated Read/Grep cycles.
    • Use vault_init, vault_sync and vault_status to attach, reindex and check a vault.
    • SelfVault indexes this repo's src/, web-portal/src/, tests/, docs/, AGENTS.md and CLAUDE.md.

Route before you read

  1. Resolve the task to a card: node scripts/repo-map-doctor.mjs --route <words>. Follow its "skip when" redirects.
  2. Read only that card's entrypoints and contracts.
  3. Go at most one hop along its depends_on.
  4. Search the whole repo only when the map missed. A miss is a bug in the map: fix that card's read_when in the same change.

Non-negotiable rules

Each of these was paid for once. This file holds one line per rule. The reason, the single producer and the detector are in the contract.

  • Path containment: never hand-roll "is X inside Y". Call isAtOrInside or isStrictlyInside from src/common/path-containment.ts, with both sides in the same spelling. → docs/contracts/path-containment.md
  • ESM: no bare require( in src. Inside a try/catch it is a silent false at run time, and the tests cannot see it. → docs/contracts/esm-no-require.md
  • Gates: a gate that refuses work ships together with the prompt sentence that asks for what it judges. → docs/contracts/gate-needs-an-asker.md
  • Tests: never make a check pass by weakening its test — no removed case or assertion, new skip, commented-out test, or loosened pin without a Test-Weakened: line in that commit. CI and the pre-push hook check every commit. → docs/contracts/test-integrity.md
  • File size: no source file grows past 1,000 lines, and the 64 that already have may not grow at all. New code goes into a module beside the file. → docs/contracts/file-size.md
  • Rules about rules: a commit that changes the checker, a hook, a workflow or a contract says why in a Governance-Change: line. CI judges each push with the checker from its base. → docs/contracts/governance.md

High-traffic router

AreaWhen you touch itContract
Pathsany inside / under / within check; a realpath compared with a typed pathdocs/contracts/path-containment.md
Module loadingrequire, a lazy or optional import, a try/catch around a loaddocs/contracts/esm-no-require.md
Gates & planning promptsa [STRADA …] gate; a rule in goal-decomposer.ts or strada-knowledge.ts; a Strada tool descriptiondocs/contracts/gate-needs-an-asker.md
Testsediting a failing test; skip/only/todo; a BASELINE or PINNED numberdocs/contracts/test-integrity.md
Large filesadding code to campaign-manager.ts, orchestrator.ts or any file over 1,000 linesdocs/contracts/file-size.md

Team skills

When a request matches, load the skill file and follow it in full. The slash wrappers only load it.

  • ship — "commit this", "push", "ship it", "land it": run node scripts/ci/gates.mjs, stage explicit paths, push, watch CI. → docs/skills/ship/SKILL.md

Team memory

  • Read: at the start of a session, read docs/memory/CORE.md (40 lines). Before you enter an area, scan docs/memory/INDEX.md and open only the entries that match it. Never read entries/ in bulk.
  • Capture: an entry is worth writing when you chose between alternatives, found a root cause that was not obvious, were corrected by the owner, or finished a spike. Write it if it will recur, cannot be derived from the code, and is costly not to know. Write it in the format given in docs/memory/POLICY.md, run node scripts/memory-index.mjs, and say team-memory: <summary>.
  • Memory is not a status board. A rule that has a detector is a contract, not a memory entry.

Conventions

  • ESM imports only. Zod for all configuration and external data.
  • No any: use unknown with type guards. Use interface for object shapes and type for unions and intersections.
  • Prefer functional patterns. Use classes only for stateful components.
  • Name source files kebab-case.ts and tests kebab-case.test.ts, next to their source.
  • Keep functions focused, under ~50 lines where possible.
  • Every public function handles its errors. No unhandled promise rejections.

Git

  • Branch prefixes: feat/, fix/, refactor/, test/, docs/. Commit messages: type(scope): description. Make atomic commits, one logical change each.
  • Never commit .env, credentials or secrets. Never force-push main.
  • Never amend a commit that is already pushed: CI's Version Bump workflow fails on the rewritten sha.

Security

  • Never hardcode API keys, secrets or credentials. Validate user input at system boundaries with Zod.
  • Sanitize every file path against directory traversal. Detect absolute paths with path.isAbsolute(), not startsWith("/"). For containment, see the path-containment contract.
  • Spawning .cmd files on Windows requires shell: true (Node.js 22+, CVE-2024-27980).
  • Listeners bind 127.0.0.1 by default. BIND_HOST is the only way to widen that (it is validated; containers set 0.0.0.0).
  • Media processing includes SSRF protection and magic-byte validation. Memory and personality inputs get prompt-injection sanitization.

Boundaries

  • Do NOT modify node_modules/ or generated dist/ files.
  • Do NOT create files in the project root.
  • Do NOT modify test infrastructure (scripts/run-vitest-batches.mjs).
  • Do NOT add new npm dependencies. The project keeps a minimal dependency policy.
  • Do NOT skip or disable existing tests to make new code pass.
  • Do NOT name, quote or commit material from any external project Strada.Brain was run against. That covers names, design documents, campaign exports, measured counts and run ids, in code, comments, tests, fixtures, docs and commit messages.
    • Fixtures and examples use invented data from an unrelated domain.
    • Patterns, keyword lists and defaults are written for any project, never tuned to one document's wording or one product's look.
    • Local lists of protected terms or confidential documents, if you keep them, live in the gitignored tests/fixtures/local/*.txt. src/universality.test.ts checks every publishable file against them, and skips with a stated reason when they are absent.
  • Channel-specific code stays in its own src/channels/{name}/ directory.
  • Core orchestrator changes require careful review: the orchestrator coordinates the entire agent lifecycle.

Maintaining this file

Every session loads this file, so keep it a router and not a reference.

  • A new contract gets one row in docs/contracts/README.md, and at most one row in the router table above, and only if its area is touched weekly.
  • Never copy a contract's text, table or example here. The detail lives in exactly one place: the contract.
  • src/contracts.test.ts fails if this file names a contract that does not exist.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.