Manages architecture project state in .arch/state.json and .arch/decisions.md. Activates when reading or updating project phase state, tracking component acceptance, logging decisions, or validating phase transitions.
74
85%
Does it follow best practices?
Impact
59%
1.01xAverage score across 5 eval scenarios
Passed
No known issues
.arch/state.jsonThis file is the single source of truth for project progress. ALWAYS read it before responding to any architecture query. NEVER rely on conversation memory for phase state. ALWAYS update it after every state change.
current_phase to know where we aresub_phase and individual acceptance flags (pattern_accepted, components_overview_accepted, cross_cutting_accepted)components object for per-component statusreopens.count and reopens.max for reopen availabilityExample – read state (pseudocode; use the Read tool, not code execution):
state = Read(".arch/state.json") → parse JSON
current_phase = state["current_phase"]not_started → evaluation (when /analyze-prd runs)
evaluation → methodology (when Phase 1 is accepted)
methodology → components (when Phase 2 is fully accepted: pattern + components + cross-cutting)
components → finalization (when ALL components accepted)Backward transitions are ONLY allowed via /reopen (max 2 per project).
pattern → components_overview → cross_cuttingEach sub-phase is accepted independently via /accept. All three must be accepted for Phase 2 to be complete.
pending → in_progress (when /design-component starts)
in_progress → awaiting_acceptance (when design is presented)
awaiting_acceptance → accepted (when user accepts)
awaiting_acceptance → in_progress (when user refines)
needs-review → in_progress (after a reopen cascades)When updating state.json:
decision_count if a decision was madeExample – validate and write state (pseudocode; use Read/Write tools, not code execution):
VALID_TRANSITIONS = {
"not_started" → ["evaluation"],
"evaluation" → ["methodology"],
"methodology" → ["components"],
"components" → ["finalization"],
}
state = Read(".arch/state.json") → parse JSON
current = state["current_phase"]
if new_phase not in VALID_TRANSITIONS[current]:
# Invalid transition: do NOT write state.
# Report the error to the user and stop.
raise error: "Invalid transition: '{current}' → '{new_phase}'"
state["current_phase"] = new_phase
state["decision_count"] += 1
Write(".arch/state.json", JSON.stringify(state, indent=2))If validation fails:
state.json./reopen (subject to reopens.count < reopens.max).decisions.md under category Process if the invalid attempt was user-initiated..arch/decisions.mdAppend-only file. Never edit previous entries. Format:
### [DEC-NNN] Phase X | Category
- **Decision:** [What was decided]
- **Rationale:** [Why this choice]
- **Alternatives:** [What else was considered]
- **Trade-offs:** [What was sacrificed]
- **Risk:** [Any residual risk]
- **Date:** [ISO timestamp]Categories: Requirements | Pattern | Technology | Integration | Security | Infrastructure | Process | Reopen
Example – append a decision entry (pseudocode; use the Edit/Write tool to append, not code execution):
entry = """
### [DEC-001] Phase 1 | Pattern
- **Decision:** Adopt hexagonal architecture
- **Rationale:** Decouples domain from infrastructure
- **Alternatives:** Layered monolith
- **Trade-offs:** Higher initial complexity
- **Risk:** Team familiarity required
- **Date:** 2024-06-01T10:00:00Z
"""
Append entry to ".arch/decisions.md" using Write toolLog a decision entry for: