nac
AGENTS.md278 starsChanged 3 months agoApache-2.0View on GitHub
NAC is a Rust coding-agent harness with a React web client. It supports three immutable session behaviors: the established orchestrator/worker topology, a persistent direct coding agent with traditional child sessions, and a direct agent that can launch separate managed orchestrator sessions. Managed-host deployment is additive and opt-in. Read the nearest nested AGENTS.md before changing a subsystem. This root file defines repository-wide constraints; nested guides add ownership-specific rules. Durable architectural decisions live in docs/architecture/. Historical work ledgers and local notebooks are…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 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 repository4 other files it gives its agents.
- qaSkill
- releaseSkill
- triageSkill
- nac-onboardingSkill
The file
We split this AGENTS.md into the rules it gives an agent
11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
4
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
- Very specific: line 9
Read the nearest nested AGENTS.md before changing a subsystem.
- Distinctive: line 37
Prefer private modules and narrow exports.
- Distinctive: line 85
Read neighboring tests before changing a safety, durability, schema, recovery, or concurrency seam.
- Distinctive: line 106
Run it again after either lockfile changes.
- Distinctive: line 112
Use locked Cargo commands and targeted checks while iterating:
- Very specific: line 141
Never edit generated TypeScript by hand.
- Very specific: line 146
Keep Cargo.lock consistent with workspace manifests.
- Distinctive: line 155
Keep production modules around 500 lines where ownership permits.
- Very specific: line 157
Every tracked human-authored source/configuration/guide file must remain at or below 2,000 physical lines (make test-source-size).
- Distinctive: line 164
Put tests next to their owner, using sibling test modules when inline tests obscure production responsibilities.
- Distinctive: line 168
Avoid new dependencies when the standard library or workspace crates are adequate.
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 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
NAC repository guide
NAC is a Rust coding-agent harness with a React web client. It supports three immutable session behaviors: the established orchestrator/worker topology, a persistent direct coding agent with traditional child sessions, and a direct agent that can launch separate managed orchestrator sessions. Managed-host deployment is additive and opt-in.
Read the nearest nested AGENTS.md before changing a subsystem. This root file
defines repository-wide constraints; nested guides add ownership-specific
rules. Durable architectural decisions live in docs/architecture/. Historical
work ledgers and local notebooks are evidence, not a substitute for current code
and tests.
Dependency direction
Dependencies point inward:
React clients
-> HTTP/OpenAPI/MCP delivery (nac-server)
-> focused application services and composition ports
-> nac-core durable harness nac-managed product context
-> shared contracts/infrastructure adapters <-- Domain and application contracts must not depend on Axum, React, provider wire types, or deployment wiring.
nac-manageddoes not depend onnac-serveror the agent harness. The server composes its ports with core/project services.- Provider, filesystem, database, Git/process, sandbox, and HTTP clients are adapters around inward contracts; do not move transport types into domain APIs.
- Model-visible tool exposure, authorization, hard safety policy, and the already-selected execution backend are separate decisions. Approval never changes or escapes the backend.
- Prefer private modules and narrow exports. Add a crate only for a real dependency boundary, not to increase crate count.
See dependency boundaries and generated API contract.
Where changes belong
| Change | Owner | Start here |
| Model loop, prompts, compaction | nac-core::agent | crates/nac-core/src/agent/ |
| Session admission, recovery, cancellation, settlement | nac-core::session_service | crates/nac-core/src/session_service/AGENTS.md |
| Durable schema, transcript, relationships, inbox/goals | nac-core::store and sessions | crates/nac-core/src/store/AGENTS.md |
| Permission evaluation and approval | nac-core::permissions | crates/nac-core/src/permissions/AGENTS.md |
| Native tools, capability composition, invocation | nac-core::tools | crates/nac-core/src/tools/AGENTS.md |
| Model/runtime/backend construction | nac-core::runtime | crates/nac-core/src/runtime/ |
| Managed secrets, GitHub, clone workflow, readiness | nac-managed | crates/nac-managed/AGENTS.md |
| Product use cases and HTTP/OpenAPI/MCP delivery | nac-server | crates/nac-server/AGENTS.md |
| React features, queries, presentation | web client | crates/nac-server/web/AGENTS.md |
| Managed image/runtime contract | managed container | docker/managed/AGENTS.md |
| Shared command environment and credentials | small inward crates | crates/nac-contracts/, crates/nac-credential-store/ |
| Descendant-aware process supervision | nac-process | crates/nac-process/AGENTS.md |
| Checked-in model catalog generation | nac-catalog-gen | crates/nac-catalog-gen/AGENTS.md |
Product and compatibility invariants
- Persisted session behavior is immutable. Preserve the public values
orchestrator,direct, anddirect-with-orchestrator; omitted legacy values still default toorchestrator. - Traditional child sessions and managed orchestrators are distinct durable topologies. Do not collapse them into worker roles or a new public taxonomy.
- Preserve prompts, defaults, thread/workset behavior, MCP semantics, API shapes, configuration values, and supported migrations unless a deliberate product decision changes them.
- Durable inbox, goals, transcripts, relationships, leases, recovery, cancellation, and completion delivery must remain restart-safe and generation-aware.
- Preserve revision-checked atomic mutation, no-follow path handling, retained terminal output, cancellation/process-tree cleanup, rich results, event emission, and workspace ownership.
- Permission ordering, hard denials, canonical resource binding, remembered grant scope, and headless fail-closed behavior are safety contracts. Tool visibility is never authorization.
- Local, SSH, and optional Podman are construction-time backend choices. Authorization cannot select a different backend or grant sandbox escape.
- Managed credentials and Exa credentials retain exact-value redaction and ownership isolation. Managed features remain absent/inert when not enabled.
Read neighboring tests before changing a safety, durability, schema, recovery, or concurrency seam. Add characterization coverage with the change.
Repository map
crates/nac-core/— durable harness, model/runtime loop, tools, permissions, sessions, persistence, workspace and execution backends.crates/nac-managed/— harness-independent managed-host bounded context.crates/nac-server/— application composition plus HTTP/OpenAPI/MCP delivery and thenac-webbinary.crates/nac-server/web/— React/Vite client and production-embedded E2E.crates/nac-contracts/— narrow shared domain/port contracts.crates/nac-credential-store/— hardened private credential persistence.crates/nac-process/— shared process supervision and cleanup.docker/managed/— managed image and entrypoint contract.docs/— user documentation and tracked architecture decisions.scripts/— release, contract generation, and image checks.
Commands
In every fresh worktree, run make setup before development or verification.
Run it again after either lockfile changes. It fetches the locked Rust dependency
graph, installs the locked web dependency tree, and ensures Playwright Chromium
is available for the production E2E lane. Rust/Cargo and Node/npm are host
prerequisites; the target reports a direct installation hint when either is
missing.
Use locked Cargo commands and targeted checks while iterating:
make setup
make build
make check
make crate-check CRATE=nac-core
make crate-test CRATE=nac-core
make format-check
make lint
make test
make test-source-size
make ci
make test-durability
make test-assets
make test-e2e
make test-managed-image-contractmake test-managed-image additionally requires Docker or Podman. Treat missing
container infrastructure as an explicit coverage gap, not a passing result.
Generated files and single writers
- Rust routes and
utoipaschemas are the API source of truth.make generate-api-contractis the sole writer forcrates/nac-server/web/openapi.jsonandcrates/nac-server/web/src/app/types/openapi.generated.ts, plus the boundedcrates/nac-server/web/packages/nac-client/src/openapi.generated.tssubset. Never edit generated TypeScript by hand;make test-api-contractchecks drift. - The web build is the sole writer for committed
crates/nac-server/assets/dist/and the experimental client package'sdist/. Commit source and rebuilt outputs together;make test-assetsfails on drift. - Keep
Cargo.lockconsistent with workspace manifests. Do not hand-edit it. nac-catalog-genis the sole writer forcrates/nac-core/src/model/catalog/data/catalog.jsonandcatalog.manifest.json; see its nested guide before regeneration.
Change discipline
- Preserve unrelated dirty worktree state. Stage exact paths, inspect staged and unstaged diffs, and avoid destructive Git operations.
- Keep production modules around 500 lines where ownership permits. A cohesive
module over 800 lines needs an ownership explanation in its nearest guide.
Every tracked human-authored source/configuration/guide file must remain at
or below 2,000 physical lines (
make test-source-size). A rare cohesive exception may be at most 3,000 lines and must name its durable ownership reason in the guard; the current repository has no exceptions. Machine-owned generated artifacts and lockfiles use their existing single-writer/drift checks instead. Do not game either target with empty wrappers, numbered fragments, include-only shards, or one-call indirection. - Put tests next to their owner, using sibling test modules when inline tests obscure production responsibilities.
- Backward-compatible migrations only unless an explicit decision authorizes a break. Never rewrite stored identity or public vocabulary incidentally.
- Avoid new dependencies when the standard library or workspace crates are adequate. Importing code or changing licenses requires explicit review.
Reference repositories
External/local harness checkouts may be inspected read-only for behavioral and architectural ideas. Verify their revision before relying on them. They are not portable build inputs: never add path dependencies, copy implementations, or adopt licenses without an explicit dependency/license decision. NAC's code and settled behavior remain authoritative.
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.

