Agent skill
formax-semantics-parity-workflow
Use when implementing or modifying behavior that must stay consistent across TUI and Web (mode/input/tool/replay/order). Require canonical semantics first, then TUI/Web adapters, then renderer-specific UI.
Install this agent skill to your Project
npx add-skill https://github.com/yusifeng/formax/tree/main/.codex/skills/formax-semantics-parity-workflow
SKILL.md
formax-semantics-parity-workflow
Goal
Use this skill when changing behavior that must stay consistent across TUI, app-server, and Web: mode, input lifecycle, tool sequencing, replay, or ordering.
Read First
docs/contracts/semantics-contract.mddocs/contracts/app-server-interaction-contract.mddocs/frontend/app-server-ui-spec.mddocs/contracts/interactive-input-contract.mdwhen input lifecycle changes
These docs are canonical. If stable cross-surface behavior changes, update them before or with code.
Code Map
1) Semantic single source of truth
packages/core/src/features/semantics/*canonicalEvents.tstranscriptProjection.tsmodeSemantics.tsreplModeTransition.tsturnInputBuilder.tsinputStateMachine.ts
2) App-server contract emit / restore
packages/core/src/app-server/turnRunner.tspackages/core/src/app-server/server.tspackages/core/src/app-server/threadStore.tspackages/core/src/app-server/store/sessionEventReader.tspackages/core/src/app-server/turn/inputStore.ts
3) TUI adapter (renderer can differ, semantics cannot)
packages/core/src/features/repl/controller/send/send.tspackages/core/src/features/repl/controller/streaming/streaming.tspackages/core/src/features/repl/useReplController.ts
4) Web adapter (renderer can differ, semantics cannot)
packages/web-reference-react/src/eventAdapters.tspackages/web-reference-react/src/App.tsxpackages/web-reference-react/src/store.tspackages/web-reference-react/src/turnEventCursor.ts
5) Canonical docs to keep in sync
docs/contracts/semantics-contract.mddocs/contracts/app-server-interaction-contract.mddocs/frontend/app-server-ui-spec.mddocs/contracts/interactive-input-contract.mdwhen input lifecycle changes
High-Signal Patterns
- Semantic-first implementation order:
- define contract / event shape / state transition
- update shared semantics
- update app-server emit / replay state
- update TUI and Web adapters
- update renderer-only UI last
- Ordering discipline:
replaySeqis the primary ordering keytraceId/seqare diagnostics and turn-local hints, not global order- on replay gap, rebuild from semantic baseline; do not keep stitching stale tails
- Tool semantics discipline:
- keep
toolUseId -> toolNamesticky behavior in semantics / adapter path - never depend on UI copy to infer tool state
- keep
- Mode/input discipline:
- mode is a semantic transition, not just a visual toggle
- input lifecycle remains a finite-state machine, not ad-hoc UI flags
Minimal Workflow
- Define the event / state transition in canonical docs and the shared semantics layer first.
- Update app-server emit / replay state so the semantics remain recoverable.
- Update TUI and Web adapters to consume the shared semantics; update renderer-only UI last.
- If
packages/core/src/features/repl/**semantic-flow files move, run the REPL semantic gate before review. - Run the minimum regression set below, then review via
AGENTS.md.
Minimum Regression
bun run type-checkbun run test -- packages/core/src/features/semanticsbun run test -- packages/core/src/features/semantics/__tests__/projectionParity.test.tsbun run test -- packages/core/src/app-server/turnRunner.test.ts packages/core/src/app-server/server.test.ts packages/core/src/app-server/turn/inputStore.test.tsnpm --prefix packages/web-reference-react run type-checknpm --prefix packages/web-reference-react run test -- src/App.test.tsx src/store.test.ts src/turnEventCursor.test.ts src/toolEventNormalizer.test.tsbun run test:repl-semantic-gatewhenpackages/core/src/features/repl/**semantic-flow files change
For fixture selection and parity assertions, use references/fixtures-checklist.md.
Guardrails
- Do not patch one renderer in isolation when the bug belongs to shared semantics.
- Do not add a second semantic state machine inside TUI or Web.
- Do not use UI text or copy as semantic-state input.
- Do not introduce new ordering rules outside the shared semantics layer.
- Do not call a parity change done until app-server, TUI, and Web consume the same semantic rule.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
formax-dev-loop-workflow
Use when working on Formax code changes and you need a disciplined dev loop: keep a single mainline task, avoid scope drift, run only targeted tests (no coverage), avoid partial staging (MM), run mandatory review before commit, include an incremental optimization check, and keep commits small and reviewable.
formax-rework-convergence-workflow
Use when code has gone through repeated rework and may contain redundant logic, style drift, or tangled structure. Trigger when user asks for "返工收敛", "cleanup-pass", or requests a focused cleanup pass that reduces churn without changing behavior.
formax-tool-ui-blocks-workflow
Implement or refactor Formax tool transcript UI using the Tool UI Blocks (C-lite) pattern (ToolUiBlocks renderer + blocks presenters) to avoid touching many tool presenter files; use when adjusting ⏺/⎿ spacing, indent rules, or migrating additional tools to blocks presenters with targeted Ink/Vitest tests and Codex review before commit.
formax-web-css-convergence-workflow
Use when changing web CSS/UI styling so requirements, state ownership, and acceptance checks are locked before edits to prevent rework churn.
formax-config-settings-workflow
Use when implementing or extending /config (storage, prompt injection, request params, UI-only toggles) with tests and strict UI parity.
formax-rolling-plan-loop-workflow
Use when the user wants a reusable rolling execution pattern (README + TODO-INDEX) like plans/web-reference-react-refactor, and wants to run delivery in small validated loops.
Didn't find tool you were looking for?