Imported from stankin/mj (
AGENTS.md). Install upstream withnpx skills add stankin/mj. Copyright stays with the author.
PURPOSE
AGENTS.md is the policy gateway for agents in this repository.
It provides strict routing, hard constraints, and command contracts.
Detailed procedures live in canonical modules from ## CANONICAL DOCS.
PROJECT
- Repository type: user project initialized with
agentplane. - Gateway role: keep this file compact and deterministic; move scenario-specific details to policy modules.
- CLI rule: use
agentplanefromPATH; if unavailable, stop and request installation guidance (do not invent repo-local entrypoints). - Startup shortcut: run
## COMMANDS -> Preflight, then readdocs/user/agent-bootstrap.generated.mdx, then apply## LOAD RULESbefore any mutation.
SOURCES OF TRUTH
Priority order (highest first):
- Enforcement: CI, tests, linters, hooks, CLI validations.
- Policy gateway:
AGENTS.md. - Canonical policy modules from
## CANONICAL DOCS. - CLI guidance:
agentplane quickstart,agentplane role <ROLE>,docs/user/agent-bootstrap.generated.mdx,.agentplane/config.json. - Reference examples from
## REFERENCE EXAMPLES.
Conflict rule:
- If documentation conflicts with enforcement, enforcement wins.
- If lower-priority text conflicts with higher-priority policy, higher-priority policy wins.
SCOPE BOUNDARY
- MUST keep all actions inside this repository unless the user explicitly approves outside-repo access.
- MUST NOT read or modify global user files (
~,/etc, keychains, ssh keys, global git config) without explicit user approval. - MUST treat network access as approval-gated when
agents.approvals.require_network=true.
COMMANDS
Preflight
agentplane config show
agentplane quickstart
agentplane task list
git status --short --untracked-files=no
git rev-parse --abbrev-ref HEAD
Task lifecycle
agentplane task new --title "..." --description "..." --priority med --owner <ROLE> --tag <tag>
agentplane task plan set <task-id> --text "..." --updated-by <ROLE>
agentplane task plan approve <task-id> --by ORCHESTRATOR
agentplane task start-ready <task-id> --author <ROLE> --body "Start: ..."
agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."
agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "..." --commit <git-rev>
Verification
agentplane task verify-show <task-id>
agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."
agentplane doctor
node .agentplane/policy/check-routing.mjs
TOOLING
- Use
## COMMANDSas the canonical command source. - Use
docs/user/agent-bootstrap.generated.mdxas the canonical startup path for agent onboarding. - For policy changes, routing validation MUST pass via
node .agentplane/policy/check-routing.mjs.
LOAD RULES
Routing is strict. Load only modules that match the current task.
Always imports for mutating tasks
Condition: task includes mutation (file edits, task-state changes, commits, merge/integrate, release/publish).
@.agentplane/policy/security.must.md@.agentplane/policy/dod.core.md
Conditional imports (linear IF -> LOAD contract)
- IF
workflow_mode=directTHEN LOAD@.agentplane/policy/workflow.direct.md. - IF
workflow_mode=branch_prTHEN LOAD@.agentplane/policy/workflow.branch_pr.md. - IF task touches release/version/publish THEN LOAD
@.agentplane/policy/workflow.release.md. - IF task runs
agentplane upgradeor touches.agentplane/.upgrade/**THEN LOAD@.agentplane/policy/workflow.upgrade.md. - IF task modifies implementation code paths THEN LOAD
@.agentplane/policy/dod.code.md. - IF task modifies docs/policy-only paths (
AGENTS.md, docs,.agentplane/policy/**) THEN LOAD@.agentplane/policy/dod.docs.md. - IF task modifies policy files (
AGENTS.mdor.agentplane/policy/**) THEN LOAD@.agentplane/policy/governance.md. - IF task modifies
.agentplane/policy/incidents.mdTHEN LOAD@.agentplane/policy/incidents.md.
Routing examples:
- Example (docs-only task): rules
1|6apply indirect; do not loaddod.code.md. - Example (upgrade task): rules
4|7apply plus workflow mode rule.
Routing constraints:
- MUST NOT load unrelated policy modules.
- MUST NOT use wildcard policy paths.
- MUST keep loaded policy set minimal (target: 2-4 files per task).
- If routing is ambiguous, ask one clarifying question before loading extra modules.
MUST / MUST NOT
- MUST start with ORCHESTRATOR preflight and plan summary.
- MUST NOT perform mutating actions before explicit user approval.
- MUST create/reuse executable task IDs for any repo-state mutation.
- MUST use
agentplanecommands for task lifecycle updates; MUST NOT manually edit.agentplane/tasks.json. - MUST run
agentplane task plan approve ...andagentplane task start-ready ...sequentially (never in parallel). - MUST keep repository artifacts in English by default (unless user explicitly requests another language for a specific artifact).
- MUST NOT fabricate repository facts.
- MUST stage/commit only intentional changes for the active task scope.
- MUST stop and request re-approval when scope, risk, or verification criteria materially drift.
Role boundaries:
- ORCHESTRATOR: preflight + plan + approvals.
- PLANNER: executable task graph creation/update.
- INTEGRATOR: base integration/finish in
branch_pr.
CORE DOD
A task is done only when all are true:
- Approved scope is satisfied; no unresolved drift.
- Required checks from loaded policy modules passed.
- Security and approval gates were respected.
- Traceability exists (task ID + updated task docs).
- Verification evidence is recorded.
- No unintended tracked changes remain.
Detailed DoD rules are in .agentplane/policy/dod.core.md, .agentplane/policy/dod.code.md, and .agentplane/policy/dod.docs.md.
SIZE BUDGET
AGENTS.mdMUST stay <= 250 lines.- Every policy markdown module under
.agentplane/policy/*.mdMUST stay <= 100 lines. - Worst-case loaded policy graph (always imports + all conditional imports) MUST stay <= 600 lines.
- Enforced by
node .agentplane/policy/check-routing.mjs.
CANONICAL DOCS
- DOC
.agentplane/policy/workflow.md - DOC
.agentplane/policy/workflow.direct.md - DOC
.agentplane/policy/workflow.branch_pr.md - DOC
.agentplane/policy/workflow.release.md - DOC
.agentplane/policy/workflow.upgrade.md - DOC
.agentplane/policy/security.must.md - DOC
.agentplane/policy/dod.core.md - DOC
.agentplane/policy/dod.code.md - DOC
.agentplane/policy/dod.docs.md - DOC
.agentplane/policy/governance.md - DOC
.agentplane/policy/incidents.md
REFERENCE EXAMPLES
- EXAMPLE
.agentplane/policy/examples/pr-note.md - EXAMPLE
.agentplane/policy/examples/unit-test-pattern.md - EXAMPLE
.agentplane/policy/examples/migration-note.md
CHANGE CONTROL
- Follow incident-log, immutability, and policy-budget rules in
.agentplane/policy/governance.md. - Record situational incident rules only in
.agentplane/policy/incidents.md; do not load/read that file during normal startup unless the task directly touches it or recovery/incident handling requires it. - Keep
AGENTS.mdas a gateway; move detailed procedures to canonical modules.