Windsurf rules
.windsurf/rules/session-state.mdTrack 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.
Windsurf 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.1234567# story: e45s2389# Session State10> **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.111213Track the current state of implementation, including decisions made, pending tasks, and open questions, to ensure continuity across session boundaries and prevent "context rot."1415Session-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.1617## Goal1819Maintain 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`.2021Legacy markdown (`specs/archive/STATE.md`, `RELEASE-PLAN.md`) is **not** SoT when YAML exists — use `specs/state.yaml` only.2223When a story modifies existing behavior, patch only between matching marker pairs in `CLAUDE.md` / `AGENTS.md` `learned-preferences` fence — see e45s21.2425## Handoff block (cold start)2627When ending a session or before a context-heavy spawn, update `handoff` in `state.yaml`:2829```yaml30handoff:31 last_step_completed: "e02s01 verify-work passed"32 open_decisions:33 - "Use folder mode for e07 (>5 stories)"34 required_reading:35 - CONVENTIONS.md36 - specs/epics/e02-verification/epic.yaml37 next_skill: develop-tdd38```3940## Strategic compaction4142| Trigger | Action |43|---------|--------|44| Phase transition (Plan → Build → Verify) | Compact handoff; archive verbose decisions to ADR |45| Context > 70% estimated | Run terse-mode for status only; move detail to specs/ |46| Before `dispatch-agents` wave | `state.yaml` only channel between spawns |4748## Workflow4950### 1. Initialize (Session Start)5152If `specs/state.yaml` does not exist, or if starting a new major phase:5354- [ ] Read `specs/release-plan.yaml` and `specs/product/SCOPE_LATEST.yaml`.55- [ ] Get git metadata: `git branch --show-current` and `git rev-parse --short HEAD`.56- [ ] Create `specs/state.yaml` with active flow, git, handoff, and epic cycle if in build.5758### 2. Load (Context Refresh)5960When starting a new session or after a significant context flush:6162- [ ] Read `specs/state.yaml` to understand where the previous agent left off.63- [ ] Read `specs/execution-status.yaml` for story progress (do not infer from release-plan).64- [ ] Verify git matches `state.yaml` `git.branch` / `git.hash`.6566### 3. Update (Decision Point/Milestone)6768Whenever a significant decision is made or a milestone is reached:6970- [ ] Patch via `bash scripts/bp-yaml-set.sh specs/state.yaml git.hash <hash>` (or edit directly).71- [ ] Patch `handoff` and `learned_preferences` / `workspace_facts` in `CLAUDE.md` fenced block when durable user preferences or repo facts crystallize (e45s23).72- [ ] Update `handoff.open_decisions` with rationale.73- [ ] Update `epic_cycle` when advancing `ship-epic` steps.74- [ ] Record open questions under `handoff.open_decisions` or an ADR.7576→ verify: `bash scripts/validate-specs-yaml.sh`7778## Universal checkpoint pattern7980Every multi-step flow (>3 steps) in bigpowers uses a cycle counter in `state.yaml`:8182| Flow | Cycle key | Step field | Phases/Steps |83|------|-----------|------------|-------------|84| build-epic | `epic_cycle` | `current_step` | 8 (survey → release) |85| fix-bug | `bug_cycle` | `current_step` | 5 (investigate → release) |86| orchestrate-project | `project_cycle` | `current_phase` | 6 (discover → release) |8788**Checkpoint:** After each step/phase completes, increment the counter in `state.yaml` and update `handoff.next_skill`.8990**Resume:** On session start, read the current step/phase from the cycle key — continue from there, not from step 1.9192**Completed steps:** Track completed steps in `completed_steps` (comma-separated string) for audit trail.9394## Strategic compaction9596Print the current session state: `cat specs/state.yaml`, then display `active_flow` and `handoff.next_skill` for quick reference.9798### reset-state (absorbed)99100Clear 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.101102### compact-state (absorbed)103104Archive verbose decisions before a context transition. Move all entries from `handoff.open_decisions` to their appropriate location:105106- **System-wide decisions** → `specs/adr/NNNN-slug.md` (global Architectural Decision Records)107- **Epic-scoped decisions** → `specs/epics/<active_epic_id>-<slug>/adr/NNNN-slug.md` (epic-local ADRs, archived with epic)108109After archiving, reset `handoff.open_decisions` to an empty list.110111## File Format: specs/state.yaml112113```yaml114active_flow: build_epic # planning | build_epic | fix_bug115active_epic_id: e02116active_story_id: e02s01 # required when epic mode: folder117active_bug_id: null # BUG-2026-06-01T143022 when fix_bug118release:119 target_version: null # NOT tracked manually — semantic-release decides at merge120 last_tag: v2.28.0 # mirror of `gh release view`, reference only121 last_publish: null122epic_cycle:123 current_step: develop-tdd124 next_skill: develop-tdd125 completed_steps: [kickoff-branch]126bug_cycle:127 current_step: null128 completed_steps: []129git:130 branch: feat/e02-verify131 hash: abc1234132handoff:133 last_step_completed: null134 open_decisions: []135 next_skill: survey-context136```137138## Anti-Patterns139140- **Duplicate Plan**: Don't copy `release-plan.yaml` or epic shards into `state.yaml`.141- **Stale State**: Forgetting to update `state.yaml` after a major refactor or decision.142- **Status in release-plan**: Story/epic status lives only in `execution-status.yaml`.143144145<!-- story: e03s03 -->146<!-- story: e04s01 -->147
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 |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.windsurf/rules/organize-workspace.md · 114 | Windsurf rules | buildstylegitdeployment+2 | 89/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/guard-git.md · 114 | Windsurf rules | stylearchgitsecurity+2 | 89/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/quick-fix.md · 114 | Windsurf rules | teststylegitdeployment+1 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/develop-tdd.md · 114 | Windsurf rules | teststylearchtesting-strategy+5 | 85/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/commit-message.md · 114 | Windsurf rules | lint-formatstyletypesgit+3 | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/extract-design.md · 114 | Windsurf rules | lint-formatstyledependenciesui | 82/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/setup-environment.md · 114 | Windsurf rules | setupstylesecuritydo-not+1 | 81/100 | 3 days ago | |
| danielvm-git/bigpowers.windsurf/rules/wire-ci.md · 114 | Windsurf rules | buildtestlint-formatstyle+1 | 81/100 | 3 days ago |
