the-frame-ai 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "the-frame-ai",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "FRAME — Framework for AI-Assisted Solo Development",
5
5
  "type": "module",
6
6
  "bin": {
@@ -47,6 +47,27 @@ Keep only the last 20 entries in `.planning/memory/learnings.md` `## Decisions`.
47
47
 
48
48
  Scan `.planning/memory/learnings.md` `## Anti-Patterns`. For any entry not referenced in the last 90 days, add `[stale]` to its header — do not delete.
49
49
 
50
+ ### Step 4: Rotate STATE.md
51
+
52
+ `.planning/STATE.md` is meant to hold **only the current position**, but commands append status blocks over time (`## Prev Position`, `## Fix Result`, `## Review Result`, `## (история)`, `## Re-review …`, etc.). These accumulate and never get trimmed — a stale STATE.md bloats every session-init read.
53
+
54
+ Read `.planning/STATE.md` and count its lines:
55
+ ```bash
56
+ wc -l .planning/STATE.md
57
+ ```
58
+
59
+ If it has **more than ~60 lines** (roughly: more than the current block + 3 history blocks), rotate it:
60
+
61
+ 1. **Keep** the active `## Current Position` block (the first/topmost one — this is what session-init and `/frame:daily` read).
62
+ 2. **Keep** the `- PreCompact:` line if present (managed by the pre-compact hook).
63
+ 3. **Keep** the **3 most recent** history blocks (`Prev Position` / `Fix Result` / `Review Result` / etc.) for short-term context.
64
+ 4. **Archive the rest**: append every older block to `.planning/sessions/state-archive.md` (create it if missing, prepend a `## Archived {date}` separator). Do **not** delete outright — feature history also lives in `docs/specs/{feature}/` and git, but keep an archive for traceability.
65
+ 5. Rewrite `.planning/STATE.md` with only the kept blocks.
66
+
67
+ **Never touch the active `## Current Position` block** — losing it strands the current workflow.
68
+
69
+ After rotation, report the before/after line count.
70
+
50
71
  ### Step 6: Archive old specs
51
72
 
52
73
  ```bash
@@ -70,6 +91,7 @@ Create `.planning/reports/cleanup/{date}.md`:
70
91
  - [x] learnings.md Patterns: Core/Archive split (N promoted, N stale-marked, N archived)
71
92
  - [x] learnings.md Decisions: trimmed to 20 entries
72
93
  - [x] learnings.md Anti-patterns: stale-marked (N)
94
+ - [x] STATE.md: rotated ({before} → {after} lines, N blocks archived) or "not needed"
73
95
  - [x] Specs archived: N
74
96
  - [x] MAP.md: verified (N missing)
75
97
 
@@ -42,9 +42,19 @@ PHASE=$(grep "^- Phase:" "$STATE_FILE" 2>/dev/null | head -1 | sed 's/.*Phase: /
42
42
  FEATURE=$(grep "^- Feature:" "$STATE_FILE" 2>/dev/null | head -1 | sed 's/.*Feature: //')
43
43
  TASK=$(grep "^- Task:" "$STATE_FILE" 2>/dev/null | head -1 | sed 's/.*Task: //')
44
44
 
45
+ # STATE.md bloat check — history blocks accumulate and are never trimmed automatically.
46
+ # Threshold: 200 lines (a healthy STATE.md is the current block + a few history blocks).
47
+ STATE_BLOAT_THRESHOLD=200
48
+ STATE_LINES=$(wc -l < "$STATE_FILE" 2>/dev/null | tr -d ' ')
49
+ STATE_WARN=""
50
+ if [ "${STATE_LINES:-0}" -gt "$STATE_BLOAT_THRESHOLD" ]; then
51
+ STATE_WARN="⚠ FRAME: STATE.md has grown to ${STATE_LINES} lines — run /frame:cleanup-memory to archive old history blocks."
52
+ fi
53
+
45
54
  # < 2 hours: one-liner
46
55
  if [ "$ELAPSED" -lt 7200 ]; then
47
56
  echo "FRAME | Phase: ${PHASE:-?} | Feature: ${FEATURE:-?} | Task: ${TASK:-?}"
57
+ [ -n "$STATE_WARN" ] && echo "$STATE_WARN"
48
58
  exit 0
49
59
  fi
50
60
 
@@ -60,6 +70,7 @@ if [ "$ELAPSED" -lt 86400 ]; then
60
70
  echo " Recent commits:"
61
71
  git log --oneline -3 2>/dev/null | sed 's/^/ /'
62
72
  echo ""
73
+ [ -n "$STATE_WARN" ] && echo " $STATE_WARN" && echo ""
63
74
  exit 0
64
75
  fi
65
76
 
@@ -87,5 +98,6 @@ git log --oneline -5 2>/dev/null | sed 's/^/ /'
87
98
  echo ""
88
99
  echo "Commands: /frame:status, /frame:context, /frame:daily, /frame:fast"
89
100
  echo ""
101
+ [ -n "$STATE_WARN" ] && echo "$STATE_WARN" && echo ""
90
102
 
91
103
  exit 0
@@ -11,3 +11,4 @@
11
11
  ## Notes
12
12
  - Run /frame:init to scan your codebase and populate MAP.md
13
13
  - Run /frame:doctor to verify all systems
14
+ - Keep this file small: `## Current Position` is **overwritten**, not appended. Feature history lives in `docs/specs/{feature}/` and git — don't accumulate it here. Past ~200 lines, run /frame:cleanup-memory to rotate old blocks into `.planning/sessions/state-archive.md`.