## Operating Mode

- Default to **{{RUNTIME_MODE}}**.
- Runtime profile: {{RUNTIME_PROFILE}}.
- Recovery profile: `{{RECOVERY_PROFILE}}`.
- State profile: `{{STATE_PROFILE}}`.
- Context profile: `{{CONTEXT_PROFILE}}`.
- Claude runtime expectation: `{{CLAUDE_POLICY}}`.
- Codex runtime expectation: `{{CODEX_POLICY}}`.
- Do not implement until the user explicitly asks to implement.
- Stable product truth: `docs/spec.md`.
- Research reports: `docs/researches/`.
- Deferred-goal ledger: `tasks/todos.md` (active execution stays in the plan's `## Task Breakdown`).
- Task contract done gate: `tasks/contracts/` (legacy name: sprint contract).
- Evaluator verdicts: `tasks/reviews/`.
- Implementation notes: `tasks/notes/`.
- Structured checks: `.ai/harness/checks/latest.json`.
- Session handoff: `.ai/harness/handoff/current.md`.
- Harness policy: `.ai/harness/policy.json`.
- Context map: `.ai/context/context-map.json`.
- Lessons contract: `tasks/lessons.md`.
- Plan directory: `plans/` (timestamped plans).
- Active plan rule: `.ai/harness/active-plan` for this worktree when present, `.ai/harness/active-worktree` as owner marker, and `.claude/.active-plan` legacy fallback during transition. Do not infer active execution from the latest plan.
- Plan archive: `plans/archive/`.
- Todo archive: `tasks/archive/`.
- Shared automation layer: `.ai/hooks/`.
- Host adapters: user-level `~/.claude/settings.json` and `~/.codex/hooks.json` call `local-repo-harness-hook`, falling back to `local-repo-harness hook`, which dispatches into opted-in repos.
- External reference cache: `_ref/` is an occasional ignored external checkout cache, read/refresh-only comparison material, and must stay out of commits; decisions based on it must cite repo+commit/tag+path in notes or research.
- Deployment operations workspace: `deploy/` is commit-ready for runbooks, submission materials, release checklists, helper scripts, ordered SQL files under `deploy/sql/`, and env examples.
- Local operations state: `_ops/` is ignored and private for secrets, real env files, provider state, artifacts, logs, and scratch files; do not commit or agent-edit `_ops/*`.
- Agentic skill routing: product discovery -> gstack `office-hours`; complex engineering plans -> gstack `plan-eng-review`; design plans -> gstack `plan-design-review`; daily small/medium planning, bug hunts, and checks -> Waza `/think`, `/hunt`, `/check`.
- Knowledge sync and handoff retrieval -> `gbrain`.
- Codex automation profile: required `health`, `check`, and `mermaid` from `~/.codex/skills`; do not vendor skill bodies.
- CodeGraph readiness: required for agent code navigation; keep `.codegraph/` ignored and use `codegraph sync/context/query/callers/callees/impact` for P1/P2 discovery.
- External tooling reference: `docs/reference-configs/agentic-development-flow.md` for routing details, `docs/reference-configs/external-tooling.md` for install/update guidance.
- Waza runtime boundary: Codex reads `~/.codex/skills`; `~/.agents/skills` is only skills CLI staging/cache and must be copied into Codex with verification after updates.
- Environment check: `bash .ai/harness/scripts/check-agent-tooling.sh --host both --check-updates`.
- After substantive repo changes, run `bash .ai/harness/scripts/check-task-sync.sh` and `bash .ai/harness/scripts/check-task-workflow.sh --strict`.
- Primary worktree warns by default; enforce via `.claude/.require-worktree`.
- Contract-level execution is worktree-first: `.ai/harness/scripts/plan-to-todo.sh --plan <approved-plan>` starts a linked `codex/<slug>` worktree when policy enables it, and `.ai/harness/scripts/contract-worktree.sh finish` merges back only after Waza `/check` and sprint verification pass.
- After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete plan, capture it with `.ai/harness/scripts/capture-plan.sh --slug <slug> --title <title>`; if implementation is already approved, capture with `--status Approved --execute` or run `.ai/harness/scripts/plan-to-todo.sh --plan <active-plan>`.
- If repo state conflicts with the task, use an isolated `codex/<task-slug>` worktree, validate with Waza `/check`, and merge back to `main` without unrelated dirty changes.

---
