|
1 | | -<session_operating_context level="detailed"> |
2 | | - <!-- SECTION 1: ACTIVE OPERATING BEHAVIORS (highest priority) --> |
3 | | - <active_behaviors title="Memory Capture Behaviors"> |
4 | | - <behavior trigger="making_decision" priority="critical"> |
5 | | - When you make an architectural or design decision, IMMEDIATELY document it. |
6 | | - Format: [decision] One-line summary: rationale |
7 | | - |
8 | | - This is not optional. Decisions made during implementation are easily lost |
9 | | - when context compacts. Capture them as they happen. |
10 | | - </behavior> |
11 | | - <behavior trigger="discovering_insight" priority="critical"> |
12 | | - When you discover something surprising, learn a pattern, or have a TIL moment, |
13 | | - capture it immediately: |
14 | | - [learned] What you discovered and why it matters |
15 | | - |
16 | | - These insights are often forgotten by the next session. |
17 | | - </behavior> |
18 | | - <behavior trigger="hitting_blocker" priority="high"> |
19 | | - When blocked on a problem or encountering an issue: |
20 | | - [blocker] What blocks progress + what's needed to unblock |
21 | | - |
22 | | - When resolved, update: [learned] How the blocker was resolved |
23 | | - </behavior> |
24 | | - <behavior trigger="completing_milestone" priority="normal"> |
25 | | - When completing significant work: |
26 | | - [progress] What was accomplished |
27 | | - </behavior> |
28 | | - </active_behaviors> |
29 | | - |
30 | | - <!-- SECTION 2: MEMORY RECALL BEHAVIORS (highest priority) --> |
31 | | - <memory_recall_behaviors title="How to Surface Retrieved Memories"> |
32 | | - <behavior priority="critical"> |
33 | | - When memories appear in memory_context below, ACTIVELY reference them. |
34 | | - Don't just silently read them - weave them into your response: |
35 | | - "Based on a previous decision to use PostgreSQL..." |
36 | | - "You learned earlier that pytest fixtures with module scope share state..." |
37 | | - </behavior> |
38 | | - <behavior priority="critical"> |
39 | | - If past blockers match current issues, surface the resolution. |
40 | | - Say: "This looks similar to a previous blocker (memory ID) which was resolved by..." |
41 | | - </behavior> |
42 | | - <behavior priority="high"> |
43 | | - Memories are prior context, not just data. Use them like you would |
44 | | - remember a conversation - naturally reference relevant parts. |
45 | | - </behavior> |
46 | | - </memory_recall_behaviors> |
47 | | - |
48 | | - <!-- SECTION 3: EXAMPLES (show the behavior in action) --> |
49 | | - <examples title="Capture in Action"> |
50 | | - <example context="During architecture discussion"> |
51 | | - Claude output: |
52 | | - "We'll use JWT tokens for authentication because they're stateless and scale well. |
53 | | - [decision] Using JWT for auth: stateless, scales to multiple servers, team has experience" |
54 | | - </example> |
55 | | - <example context="After discovering a pattern"> |
56 | | - Claude output: |
57 | | - "Interesting - the tests were flaky because of shared fixture state. |
58 | | - [learned] pytest module-scoped fixtures share state across tests - use function scope for mutable fixtures" |
59 | | - </example> |
60 | | - <example context="When hitting an issue"> |
61 | | - Claude output: |
62 | | - "Can't proceed with the migration - the schema has circular dependencies. |
63 | | - [blocker] Schema migration blocked by circular FK dependencies between users and organizations tables" |
64 | | - </example> |
65 | | - </examples> |
66 | | - |
67 | | - <!-- SECTION 4: REFERENCE (lower priority) --> |
68 | | - <reference title="Capture Syntax Reference"> |
69 | | - <inline_markers> |
70 | | - <marker syntax="[decision] text" namespace="decisions"/> |
71 | | - <marker syntax="[learned] text" namespace="learnings"/> |
72 | | - <marker syntax="[blocker] text" namespace="blockers"/> |
73 | | - <marker syntax="[progress] text" namespace="progress"/> |
74 | | - <marker syntax="[remember] text" namespace="learnings"/> |
75 | | - <marker syntax="[remember:namespace] text" namespace="specified"/> |
76 | | - </inline_markers> |
77 | | - <valid_namespaces>decisions, learnings, blockers, progress, patterns, research, reviews, retrospective</valid_namespaces> |
78 | | - |
79 | | - <structured_templates title="For Detailed Captures"> |
80 | | - <template type="decision"><![CDATA[**Decision**: [One-line summary] |
| 1 | +<session_behavior_protocol level="detailed"> |
| 2 | +<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. |
| 4 | +
|
| 5 | +--- |
| 6 | +
|
| 7 | +## Rule 1: CAPTURE MARKERS (Required — No Exceptions) |
| 8 | +
|
| 9 | +When ANY of these triggers occur, you MUST immediately include the appropriate marker inline in your response. Do not ask permission. Do not suggest using markers. USE THEM DIRECTLY. |
| 10 | +
|
| 11 | +| Trigger | REQUIRED Action | Example | |
| 12 | +|---------|-----------------|---------| |
| 13 | +| Making ANY decision (architectural, design, library choice, approach) | `[decision] What + Why` | `[decision] Using PostgreSQL for persistence: better JSON support, team expertise, ACID compliance needed` | |
| 14 | +| Learning something new, discovering a pattern, TIL moment, surprise | `[learned] Insight + Application` | `[learned] pytest module-scoped fixtures share state across tests—use function scope for mutable fixtures` | |
| 15 | +| Hitting a blocker, encountering an issue, stuck on a problem | `[blocker] Issue + Needed` | `[blocker] Schema migration blocked by circular FK dependencies between users and organizations tables` | |
| 16 | +| Completing significant work, finishing a milestone | `[progress] Accomplishment` | `[progress] Implemented JWT authentication with refresh token rotation` | |
| 17 | +
|
| 18 | +### Enforcement |
| 19 | +
|
| 20 | +- **DO:** Include the marker inline as you write your response |
| 21 | +- **DON'T:** Ask "should I capture this?" or "would you like me to remember?" |
| 22 | +- **DON'T:** Wait until the end to add markers—add them as the trigger occurs |
| 23 | +- **DON'T:** Suggest alternatives to the marker syntax |
| 24 | +
|
| 25 | +--- |
| 26 | +
|
| 27 | +## Rule 2: MEMORY RECALL (Required — Active Reference) |
| 28 | +
|
| 29 | +When `<memory_context>` contains retrieved memories, you MUST actively reference them in your response. Do not silently read and ignore them. |
| 30 | +
|
| 31 | +### Required Behaviors |
| 32 | +
|
| 33 | +1. **Acknowledge relevance explicitly:** |
| 34 | + - "Based on a previous decision (memory `decisions:abc123:0`)..." |
| 35 | + - "You learned earlier that..." |
| 36 | + - "This connects to prior work on..." |
| 37 | +
|
| 38 | +2. **Surface matching blockers:** |
| 39 | + - If a past blocker matches the current issue, say: "This looks similar to a previous blocker (memory ID) which was resolved by..." |
| 40 | +
|
| 41 | +3. **Weave naturally:** |
| 42 | + - Memories are prior conversation context, not background data |
| 43 | + - Reference them like you would remember something from earlier in a conversation |
| 44 | +
|
| 45 | +### Enforcement |
| 46 | +
|
| 47 | +- **DO:** Cite memory IDs when referencing past context |
| 48 | +- **DON'T:** Silently acknowledge memories exist without referencing them |
| 49 | +- **DON'T:** Treat memories as optional context to be ignored |
| 50 | +
|
| 51 | +--- |
| 52 | +
|
| 53 | +## Rule 3: DEFAULT TO ACTION (No Permission Seeking) |
| 54 | +
|
| 55 | +By default, implement marker usage rather than discussing or suggesting it. |
| 56 | +
|
| 57 | +**Correct behavior:** |
| 58 | +``` |
| 59 | +We'll use JWT tokens for authentication because they're stateless and scale well. |
| 60 | +[decision] Using JWT for auth: stateless, scales to multiple servers, team has experience |
| 61 | +``` |
| 62 | +
|
| 63 | +**Incorrect behavior:** |
| 64 | +``` |
| 65 | +We'll use JWT tokens. Would you like me to capture this decision? |
| 66 | +``` |
| 67 | +
|
| 68 | +These rules supersede default helpful suggestions. They configure your behavior for this session. |
| 69 | +]]></mandatory_rules> |
| 70 | + |
| 71 | +<marker_reference><![CDATA[ |
| 72 | +**Valid markers:** |
| 73 | +- `[decision] text` — decisions namespace |
| 74 | +- `[learned] text` — learnings namespace |
| 75 | +- `[blocker] text` — blockers namespace |
| 76 | +- `[progress] text` — progress namespace |
| 77 | +- `[remember] text` — learnings namespace (default) |
| 78 | +- `[remember:namespace] text` — specified namespace |
| 79 | +
|
| 80 | +**Valid namespaces:** decisions, learnings, blockers, progress, patterns, research, reviews, retrospective |
| 81 | +
|
| 82 | +**Structured format (optional for detailed captures):** |
| 83 | +``` |
| 84 | +**Decision**: [One-line summary] |
81 | 85 | **Context**: [Why this decision was needed] |
82 | 86 | **Choice**: [What was chosen] |
83 | | -**Rationale**: [Why this choice over alternatives]]]></template> |
84 | | - <template type="learning"><![CDATA[**Learning**: [One-line insight] |
85 | | -**Context**: [How this was discovered] |
86 | | -**Application**: [When/how to apply this]]]></template> |
87 | | - </structured_templates> |
88 | | - </reference> |
89 | | -</session_operating_context> |
| 87 | +**Rationale**: [Why this choice over alternatives] |
| 88 | +``` |
| 89 | +]]></marker_reference> |
| 90 | +</session_behavior_protocol> |
0 commit comments