World State Tracking
Keep a single dedicated state file that records the shape of the running task — the goal,
the decisions, the blockers, the next step, the key paths. Unlike the conversation history,
this file is structured, finite, and survives compaction. It is the agent's answer to
"where are we?" when the context window is full.
When to use
Activate when any of these is true:
- The task is long enough that the agent has lost the thread at least once already.
- The user asks "where are we?", "what's the status?", "are we still on track?", or "remind
me what we decided".
- You are about to apply
context-pressure-compact (the state file is what survives it).
- The task has 3+ open decisions whose rationale you don't want to re-derive every turn.
- Multiple sub-agents (or the user and the agent) need a shared ground truth.
When NOT to use
- A short task (< 5 turns, no major decisions yet). The state file is overhead.
- The whole task fits in a
todowrite. Use that instead — it is already structured state.
- The state would duplicate information that lives in source files (e.g. the migration
plan already lives in
docs/migrations/auth.md; do not restate it here).
Process
Pick a single, predictable path. Default:
.minimax/state/<YYYY-MM-DD>-<short-id>.md (or, for repos without a working dir, a
tmp file under /tmp/). The path is part of the contract — re-read it from the same
place every turn.
Initialise the file the first time you activate this Skill. Use this exact shape:
# World State — <short task name>
**Started**: <ISO date>
**Owner**: <agent name or "main">
**Last updated**: <ISO timestamp>
## Goal
<one paragraph, in the user's own words, copied from the original request>
## Current phase
<one of: scoping | planning | executing | verifying | blocked | done>
## Decisions (with one-line rationale)
- <decision> — <reason>
- <decision> — <reason>
## Done
- [x] <step + result + key file path or identifier>
- [x] <...>
## In progress
- [ ] <step + where you stopped + the next concrete sub-step>
## Blockers / open questions
- <question that, if answered, would unblock the next step>
## Next concrete step
<one verb-first sentence — "Edit X to add Y", "Run Z and report output", etc.>
## Key file paths
- /abs/path/that/the/next/turn/will/need
Update the file at every meaningful boundary, not every turn. Boundaries are:
- End of a
todowrite step.
- End of a sub-task handed to a
task call.
- Right before a
context-pressure-compact.
- Immediately after a user redirection.
At each update: bump
Last updated, move items between Done / In progress, add new
Decisions, and refresh the Next concrete step.
On every new turn, read the file first (use read). It is your 30-line ground truth.
Do not skim the conversation history to "get back up to speed" — read the state file.
At context-pressure-compact time, the state file is what survives — the noisy
middle does not. The compact summary should reference the state file by path, not
duplicate its contents.
Output contract
The user sees:
- The path to the state file (one line, at the top of any meaningful response).
- On request: a short, complete snapshot of the state (the file contents, optionally
abbreviated).
- On update: a one-line "State updated: ".
Example
# World State — Auth refactor (OIDC alongside SAML)
**Started**: 2026-08-23
**Owner**: main
**Last updated**: 2026-08-23T23:55:00Z
## Goal
Refactor the auth subsystem to support OIDC as a first-class provider alongside the existing
SAML path, without breaking any of the 12 existing SAML tests.
## Current phase
planning
## Decisions (with one-line rationale)
- Keep SAML on the legacy code path; OIDC gets a parallel module. — SAML contract is frozen,
no test budget to re-validate.
- Reject "generic Provider with config-driven dispatch" — too much config surface for
marginal benefit.
- Use the `openidconnect` crate (not hand-rolled oauth2). — JWKS, PKCE, state, nonce all
solved; saves ~400 lines.
## Done
- [x] Mapped current auth flow in `src/auth/`. Wrote findings to `.minimax/snapshots/auth-flow.md`.
- [x] Confirmed test coverage: 12 of 14 files have unit tests (2 missing: `logout`, `session`).
## In progress
- [ ] Drafting the `OidcProvider` trait. Stopped at: how to represent the provider enum
vs the existing `IdP` interface. Three options on the table; see Open questions.
## Blockers / open questions
- Should the OIDC module own token storage, or reuse the existing session store?
- Does IT have a preferred OIDC library? (defaulting to `openidconnect`)
## Next concrete step
Draft the `OidcProvider` trait + one impl for `provider = "okta"`, then show the diff to
the user before touching `src/auth/callback.rs`.
## Key file paths
- /repo/src/auth/idp.rs
- /repo/src/auth/callback.rs
- /repo/tests/auth/
- /repo/docs/auth.md
Common pitfalls
- Do not put prose in the state file. Prose is what the conversation history is for. The
state file is structured, finite, and machine-grepable.
- Do not update on every turn. Update at boundaries. A state file that changes every
line is just a noisy transcript.
- Do not duplicate source-of-truth info. If the API contract lives in
docs/api.md,
the state file says "see docs/api.md", not "the API contract is ...".
- Do not let the state file grow unbounded. A 500-line state file is no longer a state
file; it is a journal. If it grows past ~80 lines, split it (e.g.
state.md +
decisions.md) or compact.
- Do not forget the path. If you can name the path from memory every turn, the state
file is doing its job. If you cannot, move it to a more obvious place.
- Do not use the state file as a substitute for
todowrite. The state file is the
long-form ground truth; todowrite is the short-form live checklist. They coexist.
Verification checklist
1---2name: world-state-tracking3description: Track running state of long task in a single dedicated file that survives compaction. USE WHEN: task is long, agent has lost thread, user asks "where are we" / "到哪了" / "我们到哪了", before `context-pressure-compact`, `todowrite` alone is too thin, agent has done > 10 tool calls, "lost the thread" / "继续" / "忘了". TRIGGER PHRASES: "where are we", "到哪了", "我们到哪了", "继续", "lost thread", "忘了", "lost the thread", "我们刚才说到哪了", "走神了", "回到主线". SKIP WHEN: short task (<5 tool calls), single one-shot question, "do X" with X being small.4license: Apache-2.05---67# World State Tracking89Keep a single dedicated state file that records the *shape* of the running task — the goal,10the decisions, the blockers, the next step, the key paths. Unlike the conversation history,11this file is **structured, finite, and survives compaction**. It is the agent's answer to12"where are we?" when the context window is full.1314## When to use1516Activate when **any** of these is true:1718- The task is long enough that the agent has lost the thread at least once already.19- The user asks "where are we?", "what's the status?", "are we still on track?", or "remind20 me what we decided".21- You are about to apply `context-pressure-compact` (the state file is what survives it).22- The task has 3+ open decisions whose rationale you don't want to re-derive every turn.23- Multiple sub-agents (or the user and the agent) need a shared ground truth.2425## When NOT to use2627- A short task (< 5 turns, no major decisions yet). The state file is overhead.28- The whole task fits in a `todowrite`. Use that instead — it is already structured state.29- The state would duplicate information that lives in source files (e.g. the migration30 plan already lives in `docs/migrations/auth.md`; do not restate it here).3132## Process33341. **Pick a single, predictable path.** Default:35 `.minimax/state/<YYYY-MM-DD>-<short-id>.md` (or, for repos without a working dir, a36 tmp file under `/tmp/`). The path is part of the contract — re-read it from the same37 place every turn.382. **Initialise the file the first time you activate this Skill.** Use this exact shape:3940 ```markdown41 # World State — <short task name>4243 **Started**: <ISO date>44 **Owner**: <agent name or "main">45 **Last updated**: <ISO timestamp>4647 ## Goal4849 <one paragraph, in the user's own words, copied from the original request>5051 ## Current phase5253 <one of: scoping | planning | executing | verifying | blocked | done>5455 ## Decisions (with one-line rationale)5657 - <decision> — <reason>58 - <decision> — <reason>5960 ## Done6162 - [x] <step + result + key file path or identifier>63 - [x] <...>6465 ## In progress6667 - [ ] <step + where you stopped + the next concrete sub-step>6869 ## Blockers / open questions7071 - <question that, if answered, would unblock the next step>7273 ## Next concrete step7475 <one verb-first sentence — "Edit X to add Y", "Run Z and report output", etc.>7677 ## Key file paths7879 - /abs/path/that/the/next/turn/will/need80 ```81823. **Update the file at every meaningful boundary**, not every turn. Boundaries are:83 - End of a `todowrite` step.84 - End of a sub-task handed to a `task` call.85 - Right before a `context-pressure-compact`.86 - Immediately after a user redirection.87 At each update: bump `Last updated`, move items between Done / In progress, add new88 Decisions, and refresh the Next concrete step.894. **On every new turn, read the file first** (use `read`). It is your 30-line ground truth.90 Do not skim the conversation history to "get back up to speed" — read the state file.915. **At `context-pressure-compact` time**, the state file is what survives — the noisy92 middle does not. The compact summary should reference the state file by path, not93 duplicate its contents.9495## Output contract9697The user sees:9899- The path to the state file (one line, at the top of any meaningful response).100- On request: a short, *complete* snapshot of the state (the file contents, optionally101 abbreviated).102- On update: a one-line "State updated: <new Last updated>".103104## Example105106```markdown107# World State — Auth refactor (OIDC alongside SAML)108109**Started**: 2026-08-23110**Owner**: main111**Last updated**: 2026-08-23T23:55:00Z112113## Goal114115Refactor the auth subsystem to support OIDC as a first-class provider alongside the existing116SAML path, without breaking any of the 12 existing SAML tests.117118## Current phase119120planning121122## Decisions (with one-line rationale)123124- Keep SAML on the legacy code path; OIDC gets a parallel module. — SAML contract is frozen,125 no test budget to re-validate.126- Reject "generic Provider with config-driven dispatch" — too much config surface for127 marginal benefit.128- Use the `openidconnect` crate (not hand-rolled oauth2). — JWKS, PKCE, state, nonce all129 solved; saves ~400 lines.130131## Done132133- [x] Mapped current auth flow in `src/auth/`. Wrote findings to `.minimax/snapshots/auth-flow.md`.134- [x] Confirmed test coverage: 12 of 14 files have unit tests (2 missing: `logout`, `session`).135136## In progress137138- [ ] Drafting the `OidcProvider` trait. Stopped at: how to represent the provider enum139 vs the existing `IdP` interface. Three options on the table; see Open questions.140141## Blockers / open questions142143- Should the OIDC module own token storage, or reuse the existing session store?144- Does IT have a preferred OIDC library? (defaulting to `openidconnect`)145146## Next concrete step147148Draft the `OidcProvider` trait + one impl for `provider = "okta"`, then show the diff to149the user before touching `src/auth/callback.rs`.150151## Key file paths152153- /repo/src/auth/idp.rs154- /repo/src/auth/callback.rs155- /repo/tests/auth/156- /repo/docs/auth.md157```158159## Common pitfalls160161- **Do not put prose in the state file.** Prose is what the conversation history is for. The162 state file is structured, finite, and machine-grepable.163- **Do not update on every turn.** Update at boundaries. A state file that changes every164 line is just a noisy transcript.165- **Do not duplicate source-of-truth info.** If the API contract lives in `docs/api.md`,166 the state file says "see docs/api.md", not "the API contract is ...".167- **Do not let the state file grow unbounded.** A 500-line state file is no longer a state168 file; it is a journal. If it grows past ~80 lines, split it (e.g. `state.md` +169 `decisions.md`) or compact.170- **Do not forget the path.** If you can name the path from memory every turn, the state171 file is doing its job. If you cannot, move it to a more obvious place.172- **Do not use the state file as a substitute for `todowrite`.** The state file is the173 long-form ground truth; `todowrite` is the short-form live checklist. They coexist.174175## Verification checklist176177- [ ] Is the state file at a single, predictable path the agent can name from memory?178- [ ] Is it initialised with the full 9-section shape on first activation?179- [ ] Is it updated at boundaries (steps, sub-tasks, compactions, redirections), not every180 turn?181- [ ] Does every new turn start with `read` of the state file, not a conversation skim?182- [ ] Is the state file < ~80 lines? If not, split or compact.183- [ ] Does `context-pressure-compact` reference the state file by path, not duplicate it?184- [ ] Can a new sub-agent orient itself in < 30 seconds by reading only the state file?