@@ -78,8 +78,104 @@ This rule is ALWAYS active. Violations require immediate self-correction.
7878## 🔄 SESSION START
7979
8080** At start of EVERY session:**
81- 1 . Read ` logs/DEVLOG.md ` → "Current Context" section
82- 2 . Acknowledge: "Context read. Version [ x] , Phase [ y] , Objectives: [ z] "
81+ 1 . Read ` logs/DEVLOG.md ` → "Last Session" section (if exists) for handoff context
82+ 2 . Read ` logs/DEVLOG.md ` → "Current Context" section
83+ 3 . ** Staleness check:** If ` Last Updated ` date is >7 days old, update Current Context BEFORE other work
84+ - Tell user: "Current Context is X days old. Updating before proceeding."
85+ - Update: version, phase, objectives, recent changes
86+ - Set new ` Last Updated ` date
87+ 4 . Acknowledge: "Context read. Version [ x] , Phase [ y] , Objectives: [ z] "
88+
89+ ---
90+
91+ ## 🔚 SESSION END
92+
93+ ** ⚠️ Multi-agent:** If you are a subagent or teammate (not the lead/primary agent), skip this section. Only the primary agent writes session handoffs.
94+
95+ ** Before ending a session, write a handoff note:**
96+
97+ 1 . Update ` logs/DEVLOG.md ` → "Last Session" section (overwrite previous)
98+ 2 . Format (3 bullets max, <150 tokens):
99+ ```
100+ ## Last Session
101+ - **Done:** [What was completed this session]
102+ - **In Progress:** [What's partially done, current state]
103+ - **Next:** [What the next session should start with]
104+ - **Branch:** `branch-name` | **Last Commit:** `hash`
105+ ```
106+ 3 . Stage and commit with other changes (or amend last commit)
107+
108+ ---
109+
110+ ## 📊 TOKEN SELF-ASSESSMENT
111+
112+ ** Heuristic:** ~ 4 characters = 1 token. Use this to self-regulate without running scripts.
113+
114+ ** Quick reference:**
115+ - 1 line (~ 80 chars) ≈ 20 tokens
116+ - 1 paragraph (~ 320 chars) ≈ 80 tokens
117+ - 1 CHANGELOG entry ≈ 60-80 tokens
118+ - 1 DEVLOG compact entry ≈ 50-80 tokens
119+ - 1 DEVLOG incident entry ≈ 80-120 tokens
120+ - 1 DEVLOG standard entry ≈ 150-250 tokens
121+
122+ ** Budgets:**
123+ - CHANGELOG: <10,000 tokens
124+ - DEVLOG: <15,000 tokens
125+ - Combined: <25,000 tokens
126+
127+ ** Before writing:** Estimate entry size. If file is near budget, archive oldest entries first.
128+
129+ ---
130+
131+ ## ✏️ ENTRY VERBOSITY
132+
133+ ** Three DEVLOG entry formats:**
134+
135+ ** Compact format** (default for routine work, ~ 50-80 tokens):
136+ ```
137+ ### YYYY-MM-DD: Title
138+ Why/what in 1-2 sentences. Context or rationale.
139+ Files: `file1.py`, `file2.py`
140+ ```
141+
142+ ** Incident format** (for failures worth learning from, ~ 80-120 tokens):
143+ ```
144+ ### YYYY-MM-DD: 🚨 INCIDENT - What failed
145+ **Root Cause:** Why it happened (1-2 sentences)
146+ **Prevention:** How to stop it recurring (1-2 actions)
147+ **Detection:** How to catch it earlier next time (1 action)
148+ Files: `file1.py`, `file2.py` → CHANGELOG: `v1.2.1`
149+ ```
150+
151+ ** Incident rubric — always qualifies:** security exposure, data loss/corruption, repeated failure (3+), silent failure, rule violation with impact, regression.
152+
153+ ** Standard format** (for major decisions, milestones, ~ 150-250 tokens):
154+ ```
155+ ### YYYY-MM-DD: Title
156+ **The Situation:** ...
157+ **The Decision:** ...
158+ **Why This Matters:** ...
159+ **Files Changed:** ...
160+ ```
161+
162+ ** Decision guide:** Security/data/regression → incident. Needs an ADR → standard. Everything else → compact.
163+
164+ ---
165+
166+ ## 🔗 CROSS-REFERENCES
167+
168+ ** When writing entries that relate across files, add navigation hints:**
169+
170+ - CHANGELOG entry with a DEVLOG decision: append ` → DEVLOG YYYY-MM-DD `
171+ - DEVLOG entry referencing a specific version: append ` → CHANGELOG vX.Y.Z `
172+
173+ ** Example:**
174+ ```
175+ - Fixed token refresh bug. Files: `src/auth.js`. Commit: `abc123` → DEVLOG 2026-02-06
176+ ```
177+
178+ Hints are optional - only add when a cross-reference exists.
83179
84180---
85181
@@ -89,7 +185,9 @@ This rule is ALWAYS active. Violations require immediate self-correction.
89185
90186** Action:** Archive OLDEST entries first until under budget
911871 . Move oldest entries to ` logs/archive/[FILENAME]-YYYY-MM.md `
92- 2 . Re-run validation to confirm
188+ 2 . Add summary line to the Archive section of the source file:
189+ ` - [FILENAME-YYYY-MM.md](archive/FILENAME-YYYY-MM.md) - Brief description of contents `
190+ 3 . Re-run validation to confirm
93191
94192** Key:** Archive by TOKEN COUNT, not date. Recent entries may need archiving if over budget.
95193
0 commit comments