Cursor rule
.cursor/rules/session-state.mdcTrack implementation decisions and progress in specs/state.yaml to prevent context rot. Use at the start of a session to load context, and whenever a significant decision is made or a milestone is reached.
Cursor rules
Quality
82/100
Scores the file, not the repository.Length
789 words
15 headings · 2 code blocksRepository
114
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.123456# story: e45s2378# Session State9> **HARD GATE** — **HARD GATE** — Session state must be synchronized with git state. If state.yaml conflicts with the working tree, halt and ask for clarification. Do NOT assume state is correct.101112Track the current state of implementation, including decisions made, pending tasks, and open questions, to ensure continuity across session boundaries and prevent "context rot."1314Session-state implements the **isolate** strategy from the context-engineering framework (docs/references/context-engineering.md): each agent gets exactly the context it needs — no more — by recording decisions so the next agent can cold-start without replaying history. The four strategies (write, select, compress, isolate) work together: session-state handles isolation, terse-mode handles compression, survey-context handles selection, and CONVENTIONS.md ensures token-efficient writing.1516## Goal1718Maintain a single source of truth for the *current* session in `specs/state.yaml`. This complements long-term docs in `specs/tech-architecture/` and delivery detail in `specs/epics/` + `specs/release-plan.yaml`.1920Legacy markdown (`specs/archive/STATE.md`, `RELEASE-PLAN.md`) is **not** SoT when YAML exists — use `specs/state.yaml` only.2122When a story modifies existing behavior, patch only between matching marker pairs in `CLAUDE.md` / `AGENTS.md` `learned-preferences` fence — see e45s21.2324## Handoff block (cold start)2526When ending a session or before a context-heavy spawn, update `handoff` in `state.yaml`:2728```yaml29handoff:30 last_step_completed: "e02s01 verify-work passed"31 open_decisions:32 - "Use folder mode for e07 (>5 stories)"33 required_reading:34 - CONVENTIONS.md35 - specs/epics/e02-verification/epic.yaml36 next_skill: develop-tdd37```3839## Strategic compaction4041| Trigger | Action |42|---------|--------|43| Phase transition (Plan → Build → Verify) | Compact handoff; archive verbose decisions to ADR |44| Context > 70% estimated | Run terse-mode for status only; move detail to specs/ |45| Before `dispatch-agents` wave | `state.yaml` only channel between spawns |4647## Workflow4849### 1. Initialize (Session Start)5051If `specs/state.yaml` does not exist, or if starting a new major phase:5253- [ ] Read `specs/release-plan.yaml` and `specs/product/SCOPE_LATEST.yaml`.54- [ ] Get git metadata: `git branch --show-current` and `git rev-parse --short HEAD`.55- [ ] Create `specs/state.yaml` with active flow, git, handoff, and epic cycle if in build.5657### 2. Load (Context Refresh)5859When starting a new session or after a significant context flush:6061- [ ] Read `specs/state.yaml` to understand where the previous agent left off.62- [ ] Read `specs/execution-status.yaml` for story progress (do not infer from release-plan).63- [ ] Verify git matches `state.yaml` `git.branch` / `git.hash`.6465### 3. Update (Decision Point/Milestone)6667Whenever a significant decision is made or a milestone is reached:6869- [ ] Patch via `bash scripts/bp-yaml-set.sh specs/state.yaml git.hash <hash>` (or edit directly).70- [ ] Patch `handoff` and `learned_preferences` / `workspace_facts` in `CLAUDE.md` fenced block when durable user preferences or repo facts crystallize (e45s23).71- [ ] Update `handoff.open_decisions` with rationale.72- [ ] Update `epic_cycle` when advancing `ship-epic` steps.73- [ ] Record open questions under `handoff.open_decisions` or an ADR.7475→ verify: `bash scripts/validate-specs-yaml.sh`7677## Universal checkpoint pattern7879Every multi-step flow (>3 steps) in bigpowers uses a cycle counter in `state.yaml`:8081| Flow | Cycle key | Step field | Phases/Steps |82|------|-----------|------------|-------------|83| build-epic | `epic_cycle` | `current_step` | 8 (survey → release) |84| fix-bug | `bug_cycle` | `current_step` | 5 (investigate → release) |85| orchestrate-project | `project_cycle` | `current_phase` | 6 (discover → release) |8687**Checkpoint:** After each step/phase completes, increment the counter in `state.yaml` and update `handoff.next_skill`.8889**Resume:** On session start, read the current step/phase from the cycle key — continue from there, not from step 1.9091**Completed steps:** Track completed steps in `completed_steps` (comma-separated string) for audit trail.9293## Strategic compaction9495Print the current session state: `cat specs/state.yaml`, then display `active_flow` and `handoff.next_skill` for quick reference.9697### reset-state (absorbed)9899Clear ephemeral session state. Set `active_epic_id`, `active_story_id`, and `epic_cycle.current_step` to `null` in `specs/state.yaml`. Use when ending a phase or starting a new project context.100101### compact-state (absorbed)102103Archive verbose decisions before a context transition. Move all entries from `handoff.open_decisions` to their appropriate location:104105- **System-wide decisions** → `specs/adr/NNNN-slug.md` (global Architectural Decision Records)106- **Epic-scoped decisions** → `specs/epics/<active_epic_id>-<slug>/adr/NNNN-slug.md` (epic-local ADRs, archived with epic)107108After archiving, reset `handoff.open_decisions` to an empty list.109110## File Format: specs/state.yaml111112```yaml113active_flow: build_epic # planning | build_epic | fix_bug114active_epic_id: e02115active_story_id: e02s01 # required when epic mode: folder116active_bug_id: null # BUG-2026-06-01T143022 when fix_bug117release:118 target_version: null # NOT tracked manually — semantic-release decides at merge119 last_tag: v2.28.0 # mirror of `gh release view`, reference only120 last_publish: null121epic_cycle:122 current_step: develop-tdd123 next_skill: develop-tdd124 completed_steps: [kickoff-branch]125bug_cycle:126 current_step: null127 completed_steps: []128git:129 branch: feat/e02-verify130 hash: abc1234131handoff:132 last_step_completed: null133 open_decisions: []134 next_skill: survey-context135```136137## Anti-Patterns138139- **Duplicate Plan**: Don't copy `release-plan.yaml` or epic shards into `state.yaml`.140- **Stale State**: Forgetting to update `state.yaml` after a major refactor or decision.141- **Status in release-plan**: Story/epic status lives only in `execution-status.yaml`.142143144<!-- story: e03s03 -->145<!-- story: e04s01 -->146
Also in danielvm-git/bigpowers
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.cursor/rules/align-grid.mdc · 114 | Cursor rules | lint-formatdo-notagent-behaviour | 65/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/assess-impact.mdc · 114 | Cursor rules | testtesting-strategydeployment | 66/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/audit-code.mdc · 114 | Cursor rules | setuptestlint-formatstyle+4 | 66/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/audit-plan.mdc · 114 | Cursor rules | buildteststylegit | 74/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/build-epic.mdc · 114 | Cursor rules | buildgit | 58/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/change-request.mdc · 114 | Cursor rules | no sections | 48/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/commit-message.mdc · 114 | Cursor rules | lint-formatstyletypesgit+3 | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/compose-workflow.mdc · 114 | Cursor rules | styledo-notagent-behaviour | 65/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/context7-mcp.mdc · 114 | Cursor rules | style | 54/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/craft-skill.mdc · 114 | Cursor rules | stylearchgitdo-not | 69/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/deepen-architecture.mdc · 114 | Cursor rules | testtesting-strategydo-not | 57/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/define-language.mdc · 114 | Cursor rules | lint-formatdo-not | 65/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/define-success.mdc · 114 | Cursor rules | no sections | 4/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/delegate-task.mdc · 114 | Cursor rules | git | 62/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/deploy.mdc · 114 | Cursor rules | setupbuildtestdeployment | 77/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/design-interface.mdc · 114 | Cursor rules | styleagent-behaviour | 58/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/develop-tdd.mdc · 114 | Cursor rules | teststylearchtesting-strategy+5 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/diagnose-root.mdc · 114 | Cursor rules | no sections | 39/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/diagnose-stall.mdc · 114 | Cursor rules | no sections | 44/100 | 3 days ago | |
| danielvm-git/bigpowers.cursor/rules/dispatch-agents.mdc · 114 | Cursor rules | git | 54/100 | 3 days ago |
Diff against .cursor/rules/align-grid.mdc Diff against .cursor/rules/assess-impact.mdc Diff against .cursor/rules/audit-code.mdc Diff against .cursor/rules/audit-plan.mdc Diff against .cursor/rules/build-epic.mdc Diff against .cursor/rules/change-request.mdc Diff against .cursor/rules/commit-message.mdc Diff against .cursor/rules/compose-workflow.mdc Diff against .cursor/rules/context7-mcp.mdc Diff against .cursor/rules/craft-skill.mdc Diff against .cursor/rules/deepen-architecture.mdc Diff against .cursor/rules/define-language.mdc Diff against .cursor/rules/define-success.mdc Diff against .cursor/rules/delegate-task.mdc Diff against .cursor/rules/deploy.mdc Diff against .cursor/rules/design-interface.mdc Diff against .cursor/rules/develop-tdd.mdc Diff against .cursor/rules/diagnose-root.mdc Diff against .cursor/rules/diagnose-stall.mdc Diff against .cursor/rules/dispatch-agents.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago |
