This document defines how the agentic development system operates for this repository. It is the execution-governance layer between the human-authored product documents and Codex-based implementation work.
This document governs:
- agent roles and boundaries
- approval rules
- handoff rules
- testing and retry policy
- version-control gating
- planning and reporting conventions
It does not override product meaning.
The agent system must follow the document priority below.
DISCOVERY.mdSPEC.md
These documents define product intent, meaning, scope, and UX direction. Agents must not rewrite, weaken, or reinterpret them beyond their explicit content. Any change that may affect product meaning must be escalated to the human.
AGENT_SYSTEM.mdSCAFFOLD.mdAGENTS.mdPLANS.md
These documents may be changed only through the derived-document change policy defined below.
The following files are immutable unless the human directly edits them:
DISCOVERY.mdSPEC.md
Agents may reference them, quote them, and derive execution behavior from them, but may not modify them.
The following are controlled documents:
AGENT_SYSTEM.mdSCAFFOLD.mdAGENTS.mdPLANS.md
To avoid slowing execution unnecessarily, derived document changes are divided into two classes.
These require:
proposal -> human approval -> apply
Examples:
- milestone structure changes
- scaffold boundary changes
- agent role/authority changes
- status model changes
- approval model changes
- hard stop changes
- testing-policy changes
- version-control gate changes
These do not require prior human approval and may be applied directly by the Orchestrator or designated agent.
Examples:
- appending work-loop logs
- updating milestone status values
- recording tests run
- recording blockers, warnings, and escalation state
- filling handoff packets during execution
The system uses a central Orchestrator model.
- The Orchestrator reads the current task context.
- The Orchestrator checks
DISCOVERY.md,SPEC.md,AGENT_SYSTEM.md,SCAFFOLD.md,AGENTS.md, andPLANS.mdas needed. - The Orchestrator plans work and assigns specialist tasks through a structured handoff packet.
- Specialists execute only within their role boundaries.
- Specialists report back to the Orchestrator.
- The Orchestrator decides whether to:
- accept the result
- replan
- retry
- escalate to the human
All specialist handoffs must go through the Orchestrator. Direct specialist-to-specialist workflow is not the default operating mode.
- There is no hard cap on concurrent specialist branches.
- The default operating preference is 2–3 concurrent specialist branches.
- More than 3 concurrent specialist branches requires explicit Orchestrator justification.
- That justification should be recorded in the
PLANS.mdwork-loop log.
The reason for this limit is coordination and integration stability, not token cost.
The system starts with six top-level agents.
Responsible for:
- reading and prioritizing source-of-truth documents
- planning and task decomposition
- issuing handoff packets
- coordinating specialists
- deciding replan / retry / escalate
- final completion judgment
- updating execution state in
PLANS.md
Responsible for:
- UI shell
- canvas interactions
- node interactions
- view-state behavior
- layout implementation
- frontend state and visual behavior
Responsible for:
- persistence
- APIs
- storage logic
- recommendation request orchestration
- auth integration wiring within approved scope
Responsible for:
- keyword cloud logic
- recommendation contracts
- AI-context assembly
- recommendation-side prompt behavior and recommendation policy implementation
Responsible for:
- validating test coverage relevance
- quality gating
- regression review
- identifying unstable or insufficient validation
- issuing PASS / WARN / BLOCK test judgments
Responsible for:
- detecting structurally sensitive changes
- enforcing version-control gating
- requiring rollback planning when needed
- issuing WARN / BLOCK when version-sensitive boundaries are crossed
The repository does not use hard file locks. Instead it uses soft ownership.
Each responsibility area may define:
Primary ownerSecondary owner
Cross-boundary edits are allowed only with Orchestrator approval.
Ownership should be described primarily by responsibility area, with example directories or modules optionally listed in parentheses.
Example style:
- Frontend Agent: primary owner for canvas and interaction layer (
app/ui,app/canvas, etc.) - Backend Agent: primary owner for persistence and API layer (
app/server,app/data, etc.)
Recommendation Agent may propose cross-domain implications, but may not directly implement outside its primary domain. Cross-domain implementation must be routed through the Orchestrator.
Every specialist task must be issued with a structured handoff packet. The packet structure is fixed, but the content is filled by the Orchestrator at runtime.
Required fields:
goalscopeconstraintscontextdone_whentests_requiredreport_format
Optional field:
assumptions
assumptions should be used only when the specialist is acting on an important implementation assumption that is not explicitly guaranteed by the source-of-truth docs.
If there is no meaningful assumption, the field should be omitted.
The full handoff packet is maintained in the Orchestrator working context.
PLANS.md should only contain a concise execution summary, not the full packet.
The Orchestrator has broad authority to coordinate and approve implementation work within the approved product meaning and system rules.
The Orchestrator must escalate to the human before proceeding when work may affect any hard-stop area.
The system must not autonomously approve or complete work that may involve:
- Product-meaning changes relative to
DISCOVERY.mdorSPEC.md - Authentication / authorization / payment / secrets / deployment-sensitive security changes beyond approved scope
- Test-policy weakening, bypass, or silent reduction of required validation
When escalation is required, the request should follow this shape:
why_blockedoptionsrecommendationrisk_of_each_option
WARN means execution may continue, but caution must be recorded. Examples:
- first failure with a clear repair path
- tests largely pass but coverage or confidence is weak
- minor ambiguity that does not change product meaning
BLOCK means the task may not be marked complete in its current state. A BLOCK should be raised when any of the following occurs:
- required tests failed
- the same failure signature repeated twice
- the task cannot be safely completed without leaving approved scope
- spec or contract ambiguity prevents safe implementation
- a Version Control boundary was crossed unexpectedly
- the same repair direction was attempted twice without new evidence
ESCALATE means human approval or judgment is required before proceeding. This should happen when:
- a hard stop is touched
- retry budget is exhausted
- product meaning may change
- security-sensitive auth/payment/secrets/deploy concerns are involved
- test-policy bypass or weakening is being considered
- Specialists may raise WARN or BLOCK conditions within their domain.
- The Version Control Agent may raise WARN or BLOCK.
- The Test Agent may raise PASS, WARN, or BLOCK.
- Only the Orchestrator escalates to the human.
When a task is BLOCKED, the required order is:
replanretryescalate
This means:
- the Orchestrator should first reconsider the task plan
- then retry within the approved retry budget
- then escalate if the task remains blocked or approaches a hard stop
Calling another specialist is not the default response unless the Orchestrator determines the actual blocking cause belongs to a different responsibility area.
No implementation task may be reported complete until relevant tests have been run and checked.
- Default self-repair budget: 3 attempts
- Absolute maximum before mandatory escalation: 5 attempts
If the same failure signature repeats twice, the Orchestrator must not continue the same repair path without new evidence.
Every completion report must include:
changed_scopetests_runresultrisks_or_follow_up
One additional task-specific field may be added if it materially helps review.
When the maximum retry budget is exhausted, a root-cause report is required with:
failure_patternattempted_fixeswhy_unresolvedrecommended_next_step
The system adopts Version Control Model B. The Version Control Agent engages whenever any one of the following boundaries is touched:
- root scaffold structure change
- shared contract or shared type change
- cross-cutting module boundary change
- rollback-sensitive refactor
- schema or migration change
- framework / runtime / build-tool change
A single qualifying boundary is enough to trigger Version Control Agent involvement.
The Version Control Agent may issue:
WARNBLOCK
It does not escalate directly to the human. The Orchestrator decides whether to escalate.
A formal rollback path is required whenever the Version Control Agent is engaged. If the Version Control Agent is not engaged, no formal rollback plan is required by default.
PLANS.md is the live execution document.
It is mutable for operational updates, but structural changes must follow proposal -> human approval -> apply.
The canonical PLANS.md status values are:
pendingreadyin_progressblockedescalateddone
review_ready is intentionally not used in the current operating model.
A work-loop update should be appended at the end of each loop.
Each loop log should contain:
loop_iddate_timeactive_milestoneagents_engagedwhat_changedtests_runresultwarnings_or_blockersnext_stepapproval_needed
approval_needed should be simple and use values such as:
nonehard_stop
If more than 3 concurrent specialist branches are used, the Orchestrator must justify that choice in the work-loop log.
Responsible for relevant:
- component tests
- interaction tests
- UI smoke checks
- visual-state behavior checks when appropriate
Responsible for relevant:
- domain tests
- persistence tests
- API/integration tests
- storage round-trip checks
Responsible for relevant:
- recommendation contract tests
- context-assembly tests
- deterministic fixture tests where possible
- recommendation I/O shape tests
Responsible for:
- checking that relevant tests were actually run
- evaluating sufficiency of validation
- issuing PASS / WARN / BLOCK
- identifying regression risk or flaky behavior
Responsible for deciding which tests are relevant for task completion and whether specialist outputs satisfy the current acceptance threshold.
Final completion judgment remains with the Orchestrator. The Test Agent has blocking authority but not final sign-off authority.
AGENT_SYSTEM.mdcontains the operating system rules.AGENTS.mdis the concise execution map for Codex.PLANS.mdis the mutable milestone and loop-log execution document.
AGENTS.md should remain short and reference this file instead of duplicating it in full.
This repository currently uses:
- immutable human-authored product source of truth
- central Orchestrator workflow
- soft ownership with primary and secondary owners
- broad Orchestrator approval within approved scope
- hard-stop-only human approval model
- fixed WARN / BLOCK / ESCALATE semantics
- mandatory test-before-completion rule
- retry budget of 3, hard max of 5
- Version Control Model B
- six canonical plan states
- derived-document structural changes requiring proposal -> approval -> apply