Route each user turn into one mode:
| Mode | Trigger | Behavior |
|---|---|---|
workflow |
Explicit delivery tasks (feat / fix / refactor / chore) or any request requiring edits/commands |
Start workflow state machine and maintain PROJECT_STATE.md |
continue |
"continue" intent or existing unfinished PROJECT_STATE.md |
Resume from state file and proceed in workflow |
general |
Q&A, explanation, consultation | Answer directly; do not start workflow by default |
When in general, if the response would require:
- file edits
- command execution
- todo/state changes
ask to switch to workflow mode before executing.
Before any development action in workflow mode:
- Check
PROJECT_STATE.md
- If missing: create from
docs/PROJECT_STATE_TEMPLATE.md - If present: update as needed
- Output a state anchor line every workflow response:
[STATE] PROJECT_STATE.md: checked/updated
No [STATE] line means workflow is not considered started.
Default role is single.
Score each dimension 0-2:
- Complexity (cross-module/cross-step logic)
- Blast radius (shared interfaces/configs/critical paths)
- Uncertainty (ambiguous requirements/design choices)
- Change risk (migration/compatibility/rollback difficulty)
- Verification cost (long or multi-path validation chain)
Routing thresholds:
0-3:single4-6:single+ mandatory reviewer pass>=7: full multi-role flowplanner -> executor -> reviewer
ac-plan(planner): writesExecution Contract, setsPLAN_FROZEN=trueac-execute(executor): requiresPLAN_FROZEN=true, executes only contract scopeac-review(reviewer): validates Evidence/Gaps against contract; can unfreeze if needed
- Language: English
- Timezone: Asia/Shanghai
- Date format:
YYYY-MM-DD - Time format: 24-hour
- Primary tool: Codex
- Compatibility shell: Claude Code via
CLAUDE.md
State maintenance is part of execution, not optional.
For every workflow turn:
- Check if state needs updates (phase, Top 3, decisions, evidence, gaps)
- Output
[STATE] ...even if no changes
Required update points:
- creating/updating todos
- completing todo items
- after commit
- phase transitions
- blockers/decisions
- lightweight edits included
PROJECT_STATE.md must contain:
- headers:
PLAN_FROZEN,CURRENT_ROLE - fixed sections:
- Goal
- Top 3 Next Actions
- Blockers
- Key Decision Index (latest 3)
- Decision Log (append-only)
- Evidence
- Gaps
- Commit Plan
- Execution Contract
git commit: allowed only when explicitly requested by user- default behavior: prepare changes without committing
git push: forbidden unless explicitly requested and confirmed- co-author footer format:
Co-Authored-By: <llm-model>
PROJECT_STATE.mdis normally not committed unless:- cross-session handoff is needed, or
- user explicitly requests it
After each completed todo item, perform self-review:
- code: logic, type safety, edge cases, side effects
- docs: factual correctness, clarity, command validity
Reference checklist: docs/REVIEW_TEMPLATES.md
If conversation becomes long or context risk is high:
- pause execution
- update
PROJECT_STATE.md - commit only if explicitly requested
- provide restart hint: "start a new chat and say
continue <task>"
| Document | Purpose |
|---|---|
PROJECT_STATE.md |
Live execution state (required in workflow) |
docs/WORKFLOW_TEMPLATES.md |
Task-type workflow playbooks |
docs/PROJECT_STATE_TEMPLATE.md |
State file template |
docs/REVIEW_TEMPLATES.md |
Self-review checklist |
docs/ARCHITECTURE.md |
Project architecture baseline |
TEN Portal is a Next.js documentation and marketing site for the TEN ecosystem, with MDX docs/blog content, bilingual routes (en/cn), and Netlify deployment.
| Item | Value |
|---|---|
| Package manager | Bun (bun.lock) |
| Framework | Next.js 16 + React 19 + TypeScript |
| Routing | App Router (app/[lang]/...) |
| Styling | Tailwind CSS 4 + custom CSS + shadcn/ui |
| Lint/Format | Biome |
| i18n | next-intl + Fumadocs i18n |
| Deployment | Netlify |
- Run
bun run checkbefore finalizing delivery. - Keep docs/content schema consistent with
source.config.ts. - Preserve locale behavior (
endefault,cnsecondary) and path compatibility. - Avoid unrelated refactors during fix-scope tasks.
- Use existing repository conventions per Biome.
- Preserve current directory semantics in
app/,components/,content/,lib/. - Prefer focused commits and minimal diff scope.
bun dev
bun build
bun lint
bun run check
bun run lint:links
bun run scripts:sync-remote-docs