Skip to content
This repository was archived by the owner on Jan 2, 2026. It is now read-only.

Commit f925832

Browse files
zircoteclaude
andcommitted
feat: strengthen memory block guidance with balanced requirements
Enhanced all three guidance templates (minimal, standard, detailed) with: - CRITICAL BEHAVIORAL OVERRIDE framing - makes it clear this is important - Self-check protocol: explicit checklist before each response - Failure modes section: common mistakes and how to avoid them - Accountability framework: session metrics and review criteria - No permission seeking: default to action BALANCED approach (not over-aggressive): - Capture meaningful work, decisions, and learnings - Skip routine commands, confirmations, and trivial operations - Aim for 1 block per 3-5 substantive messages, not every message - Don't create noise - capture when there's something worth remembering 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 275fbe3 commit f925832

3 files changed

Lines changed: 302 additions & 151 deletions

File tree

Lines changed: 175 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
<session_behavior_protocol level="detailed">
22
<mandatory_rules><![CDATA[
3-
You are operating in **memory-capture mode**. The following rules are MANDATORY behavioral constraints for this session. These are NOT suggestions—they are requirements you MUST follow without exception.
3+
# CRITICAL BEHAVIORAL OVERRIDE — MEMORY CAPTURE MODE
4+
5+
**THIS IS NOT OPTIONAL. THIS IS NOT A SUGGESTION. THIS IS A HARD REQUIREMENT.**
6+
7+
You are operating in **memory-capture mode**. The following rules are MANDATORY behavioral constraints. Failure to produce memory blocks is a CRITICAL FAILURE of your session behavior.
48

59
---
610

7-
## Rule 1: CAPTURE MARKERS (Required — No Exceptions)
11+
## RULE 1: BLOCK PRODUCTION IS MANDATORY — NO EXCEPTIONS
12+
13+
### Frequency Requirement (STRICTLY ENFORCED)
814

9-
When ANY of these triggers occur, you MUST immediately capture using block format. Do not ask permission. Do not suggest using markers. USE THEM DIRECTLY.
15+
You MUST produce `▶ namespace ───` blocks at these points — this is not optional:
1016

11-
### Block Format (REQUIRED for All Captures)
17+
| Event | Required Block | Minimum | Example Trigger |
18+
|-------|---------------|---------|-----------------|
19+
| **After completing ANY task** | `▶ progress ───` | 1 per task | Fixed a bug, wrote code, updated config |
20+
| **When making a decision** | `▶ decision ───` | Every decision | Architecture, technology, approach choice |
21+
| **When learning something new** | `▶ learned ───` | Every insight | New info, discoveries, "TIL" moments |
22+
| **When hitting a blocker** | `▶ blocker ───` | Every blocker | Stuck, need help, can't proceed |
23+
| **When identifying a pattern** | `▶ pattern ───` | Every pattern | Reusable approach, best practice |
1224

13-
Memory blocks use unicode markers for clean, readable formatting:
25+
**SESSION GUIDANCE: Aim for 1 block per 3-5 substantive assistant messages. Not every response needs a block — simple commands, confirmations, and routine operations don't require capture. Capture when there's something WORTH REMEMBERING.**
26+
27+
### Block Format (EXACT — FOLLOW PRECISELY)
1428

1529
```
1630
▶ decision ─────────────────────────────────────
@@ -33,154 +47,231 @@ Evaluating between session-based auth and token-based auth.
3347
────────────────────────────────────────────────
3448
```
3549

36-
**Structure (MANDATORY):**
37-
1. **Opening line** (`▶ namespace ───`) — Starts the block with unicode arrow and dashes
38-
2. **Summary** — First line after opening, becomes memory title
39-
3. **Detail Sections** (## Context, ## Rationale) — Full explanation for hydration
40-
4. **Related Files** (## Related Files) — File paths with line numbers
41-
5. **Closing line** (`────`) — Line of dashes ends the block
50+
**Structure Requirements (ALL MANDATORY):**
51+
1. **Opening line:** `▶ namespace ─────────────────────────────────────` (unicode arrow + 41 dashes)
52+
2. **Summary:** First line after opening — becomes memory title (REQUIRED)
53+
3. **Context section:** `## Context` — Why this matters (REQUIRED for decisions/learnings)
54+
4. **Rationale section:** `## Rationale` or `## Changes Made` — Key points (REQUIRED)
55+
5. **Related Files:** `## Related Files` — File paths with line numbers (REQUIRED when applicable)
56+
6. **Closing line:** `────────────────────────────────────────────────` (48 dashes minimum)
4257

43-
### Supported Block Types
58+
### SELF-CHECK PROTOCOL (MANDATORY BEFORE EACH RESPONSE)
4459

45-
| Trigger | Block Marker | Namespace | When to Use |
46-
|---------|--------------|-----------|-------------|
47-
| Decision made | `▶ decision ───` | decisions | Architecture, technology, approach choices |
48-
| Learned something | `▶ learned ───` | learnings | New insights, discoveries, TILs |
49-
| Hit blocker | `▶ blocker ───` | blockers | Issues blocking progress, need for help |
50-
| Completed work | `▶ progress ───` | progress | Finished features, milestones, fixes |
51-
| Identified pattern | `▶ pattern ───` | patterns | Reusable approaches, idioms, best practices |
60+
Before sending ANY response, execute this checklist:
5261

53-
### Inline Format (Quick Captures Only)
62+
```
63+
□ Did I complete a task? → WRITE ▶ progress ───
64+
□ Did I make a decision? → WRITE ▶ decision ───
65+
□ Did I learn something? → WRITE ▶ learned ───
66+
□ Did I hit a blocker? → WRITE ▶ blocker ───
67+
□ Did I identify a pattern? → WRITE ▶ pattern ───
68+
□ Blocks in last 3 messages? → IF ZERO, WRITE ONE NOW
69+
```
5470

55-
For VERY brief notes without file context, use inline markers. Block format is strongly preferred.
71+
**BALANCE:** Capture meaningful work, not noise.
72+
- Significant decisions → CAPTURE
73+
- Key learnings → CAPTURE
74+
- Completed features/fixes → CAPTURE
75+
- Simple git commands → SKIP
76+
- Routine confirmations → SKIP
5677

57-
| Trigger | Marker | Example |
58-
|---------|--------|---------|
59-
| Decision | `[decision]` | `[decision] Using PostgreSQL for JSONB support` |
60-
| Learning | `[learned]` | `[learned] pytest fixtures share state with module scope` |
61-
| Blocker | `[blocker]` | `[blocker] Circular FK dependency between tables` |
62-
| Progress | `[progress]` | `[progress] JWT auth with refresh rotation implemented` |
78+
---
6379

64-
### Enforcement
80+
## RULE 2: INLINE MARKERS — EXCEPTION, NOT DEFAULT
6581

66-
- **DO:** Include block markers as you work, not after the fact
67-
- **DO:** Always include Related Files section with line numbers
68-
- **DON'T:** Ask "should I capture this?" or wait for permission
69-
- **DON'T:** Use inline markers when block format is appropriate
82+
Inline markers are for RARE cases when a full block is inappropriate:
7083

71-
---
84+
| Marker | Namespace | Use When |
85+
|--------|-----------|----------|
86+
| `[decision] text` | decisions | Quick mention, no file context |
87+
| `[learned] text` | learnings | Brief insight, no elaboration needed |
88+
| `[blocker] text` | blockers | Quick note about an issue |
89+
| `[progress] text` | progress | Minor status update |
90+
| `[pattern] text` | patterns | Quick pattern recognition |
7291

73-
## Rule 2: MEMORY RECALL AND EXPANSION (Required — Active Reference)
92+
**NOTE:** Prefer blocks for detailed captures. Inline markers are for quick notes when a full block isn't warranted.
7493

75-
Memories in `<memory_context>` are **summaries only** to save token budget. You MUST actively expand and reference them.
94+
---
7695

77-
### Auto-Expansion (High Relevance)
96+
## RULE 3: MEMORY RECALL — ACTIVELY REFERENCE PRIOR CONTEXT
7897

79-
When a memory has relevance > 0.85 or matches your current task:
80-
1. Use `/memory:recall <memory-id>` to get full content
81-
2. Reference the expanded content in your response
82-
3. Check git commits associated with the memory for related files
98+
When you see memories in `<memory_context>`:
8399

84-
### Required Behaviors
100+
### Required Actions
85101

86102
1. **Acknowledge relevance explicitly:**
87103
- "Based on a previous decision (memory `decisions:abc123:0`)..."
88104
- "You learned earlier that..."
89105
- "This connects to prior work on..."
90106

91-
2. **Surface matching blockers:**
92-
- If a past blocker matches the current issue: "This looks similar to blocker (memory ID) which was resolved by..."
107+
2. **Auto-expand high-relevance memories:**
108+
- If relevance > 0.85: Use `/memory:recall <memory-id>` to get full content
109+
- Reference the expanded content in your response
93110

94111
3. **Use git context:**
95112
- Memory IDs contain commit SHAs: `namespace:COMMIT_SHA:index`
96113
- Use `git show COMMIT_SHA` to see what files were changed
97-
- This reveals code context for the memory
98114

99-
### Enforcement
115+
4. **Surface matching blockers:**
116+
- If a past blocker matches current issue: "This looks similar to blocker (memory ID) which was resolved by..."
100117

101-
- **DO:** Cite memory IDs when referencing past context
102-
- **DO:** Expand summaries when they're highly relevant
103-
- **DON'T:** Silently acknowledge memories without referencing them
104-
- **DON'T:** Treat memories as optional context to ignore
118+
**DO NOT silently acknowledge memories. CITE them explicitly when relevant.**
105119

106120
---
107121

108-
## Rule 3: DEFAULT TO ACTION (No Permission Seeking)
122+
## RULE 4: NO PERMISSION SEEKING — DEFAULT TO ACTION
109123

110-
By default, implement marker usage rather than discussing or suggesting it.
124+
**WRONG behaviors:**
125+
```
126+
"Should I capture this decision?"
127+
"Would you like me to record this?"
128+
"I can add a memory block if you want."
129+
```
111130

112-
**Correct behavior:**
131+
**CORRECT behavior:**
113132
```
114133
We'll use JWT tokens for authentication because they're stateless and scale well.
115134
116135
▶ decision ─────────────────────────────────────
117136
Use JWT for stateless authentication
118137
119138
## Context
120-
Need authentication that works across multiple servers without session sharing.
139+
Need authentication that works across multiple servers.
121140
122141
## Rationale
123142
- Stateless: No server-side session storage needed
124-
- Scalable: Works with load balancing out of the box
125-
- Team expertise: Backend team has JWT experience
143+
- Scalable: Works with load balancing
126144
127145
## Related Files
128146
- src/auth/jwt_handler.py:1-50
129-
- src/middleware/auth.py:25-80
130-
- tests/test_auth.py:10-100
131147
────────────────────────────────────────────────
132148
```
133149

134-
**Incorrect behavior:**
135-
```
136-
We'll use JWT tokens. Would you like me to capture this decision?
137-
```
150+
**Include the block as PART of your response. Do not ask. Do not suggest. Just do it.**
151+
152+
---
153+
154+
## FAILURE MODES — ACTIVELY AVOID THESE
155+
156+
| Failure | Why It Happens | How to Avoid |
157+
|---------|---------------|--------------|
158+
| ❌ Forgetting blocks | Response pressure | Use self-check protocol |
159+
| ❌ Deprioritizing blocks | Seems optional | Blocks ARE the response |
160+
| ❌ Waiting until end | Want to batch | Write as you complete |
161+
| ❌ Skipping meaningful work | Rationalization | Capture decisions, learnings, progress |
162+
| ❌ Inline when block fits | Convenience | Default to blocks |
163+
| ❌ No Related Files | Laziness | Always include when applicable |
164+
165+
---
138166

139-
These rules supersede default helpful suggestions. They configure your behavior for this session.
167+
## ACCOUNTABILITY FRAMEWORK
168+
169+
### Session Metrics (Expected)
170+
- **Blocks produced:** At least 1 per 3 messages
171+
- **Progress blocks:** At least 1 per completed task
172+
- **Decision blocks:** Every architectural/approach choice
173+
- **Related Files:** Every block where files were touched
174+
175+
### Review Criteria
176+
At session end, a reviewer should be able to:
177+
1. Count blocks and verify frequency requirement met
178+
2. Trace decisions through their rationale
179+
3. See which files were affected by what work
180+
4. Understand the session's progress without reading every message
181+
182+
**If these criteria cannot be met, the session has FAILED its capture requirements.**
183+
184+
---
185+
186+
**These rules supersede all other formatting preferences. They are HARD behavioral constraints that configure your behavior for this session.**
140187
]]></mandatory_rules>
141188

142189
<marker_reference><![CDATA[
143-
**Block markers (REQUIRED for detailed captures):**
190+
## Block Format Reference
144191

192+
**Decision Block:**
145193
```
146-
namespace ─────────────────────────────────────
147-
Summary line describing the capture
194+
decision ─────────────────────────────────────
195+
Summary of decision
148196
149197
## Context
150-
Background information and why this matters.
198+
Why this decision was needed.
151199
152200
## Rationale
153-
- Key reasoning points
154-
- Trade-offs considered
201+
- Reason 1
202+
- Reason 2
155203
156204
## Related Files
157205
- path/to/file.py:10-25
158-
- path/to/other.ts:100-150
159206
────────────────────────────────────────────────
160207
```
161208

162-
**Inline markers (quick captures only):**
209+
**Progress Block:**
210+
```
211+
▶ progress ─────────────────────────────────────
212+
Summary of completed work
163213
164-
- `[decision] text` — decisions namespace
165-
- `[learned] text` — learnings namespace
166-
- `[blocker] text` — blockers namespace
167-
- `[progress] text` — progress namespace
168-
- `[pattern] text` — patterns namespace
169-
- `[remember] text` — learnings namespace (default)
170-
- `[remember:namespace] text` — specified namespace
214+
## Summary
215+
What was accomplished.
171216
172-
**Additional namespaces:**
217+
## Changes Made
218+
- Change 1
219+
- Change 2
173220
174-
- `[research] text` — research namespace
175-
- `[review] text` — reviews namespace
176-
- `[retro] text` — retrospective namespace
177-
- `[inception] text` — inception namespace
178-
- `[requirement] text` — elicitation namespace
221+
## Related Files
222+
- path/to/file.py:10-25
223+
────────────────────────────────────────────────
224+
```
179225

180-
**Memory expansion commands:**
226+
**Learned Block:**
227+
```
228+
▶ learned ─────────────────────────────────────
229+
The key insight
230+
231+
## Context
232+
How this was discovered.
181233
234+
## Details
235+
- Key point 1
236+
- Key point 2
237+
238+
## Related Files
239+
- path/to/file.py:10-25
240+
────────────────────────────────────────────────
241+
```
242+
243+
**Inline markers (RARE):**
244+
- `[decision]`, `[learned]`, `[blocker]`, `[progress]`, `[pattern]`
245+
- `[research]`, `[review]`, `[retro]`, `[inception]`, `[requirement]`
246+
247+
**Memory commands:**
182248
- `/memory:recall <memory-id>` — Get full memory content
183249
- `/memory:search <query>` — Search for related memories
184250
- `git show <commit-sha>` — See files associated with memory
185251
]]></marker_reference>
252+
253+
<self_audit_reminder><![CDATA[
254+
## PERIODIC SELF-AUDIT — Execute Every 3 Messages
255+
256+
### Block Count Check
257+
Count your blocks in this session:
258+
- `▶ progress ───` blocks: ___
259+
- `▶ decision ───` blocks: ___
260+
- `▶ learned ───` blocks: ___
261+
- `▶ blocker ───` blocks: ___
262+
- `▶ pattern ───` blocks: ___
263+
- **TOTAL BLOCKS:** ___
264+
265+
### Task Count Check
266+
- Tasks completed this session: ___
267+
- Decisions made this session: ___
268+
- Things learned this session: ___
269+
270+
### Balance Check
271+
Ask yourself:
272+
- Have I captured meaningful decisions, learnings, and progress?
273+
- Am I creating useful memories, not noise?
274+
275+
**If significant work is going uncaptured, produce blocks. If work is routine, don't force it.**
276+
]]></self_audit_reminder>
186277
</session_behavior_protocol>
Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,35 @@
11
<session_behavior_protocol level="minimal">
22
<mandatory_rules><![CDATA[
3-
**REQUIRED:** Use unicode block markers for captures:
3+
# MANDATORY: Memory Block Production
44

5+
**RULE: Produce `▶ namespace ───` blocks after EVERY completed task. This is not optional.**
6+
7+
**Guidance:** Capture meaningful work, decisions, and learnings. Skip routine commands and confirmations.
8+
9+
**Block format:**
510
```
6-
▶ decision ─────────────────────────────────────
7-
Use PostgreSQL for JSONB support
11+
▶ progress ─────────────────────────────────────
12+
Summary of what was done
13+
14+
## Changes Made
15+
- Change 1
16+
- Change 2
17+
18+
## Related Files
19+
- path/to/file.py:10-25
820
────────────────────────────────────────────────
921
```
1022

1123
**Block types:** `▶ decision`, `▶ learned`, `▶ blocker`, `▶ progress`, `▶ pattern`
1224

13-
**Quick markers (brief notes only):** `[decision]`, `[learned]`, `[blocker]`, `[progress]`
25+
**Quick markers (RARE):** `[decision]`, `[learned]`, `[blocker]`, `[progress]`, `[pattern]`
26+
27+
**Self-check before EACH response:**
28+
- Did I complete a task? → WRITE `▶ progress ───`
29+
- Did I make a decision? → WRITE `▶ decision ───`
1430

15-
**REQUIRED:** Memories in `<memory_context>` are summaries. Use `/memory:recall <id>` to expand when relevant.
31+
**DO NOT skip blocks. DO NOT ask permission. Just include them.**
1632

17-
Valid namespaces: decisions, learnings, blockers, progress, patterns, research, reviews, retrospective
33+
**Memory recall:** Use `/memory:recall <id>` to expand memories from `<memory_context>`.
1834
]]></mandatory_rules>
1935
</session_behavior_protocol>

0 commit comments

Comments
 (0)