allye-pi 1.5.1

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.
@@ -0,0 +1,44 @@
1
+ # Handover: discovery-to-planning
2
+
3
+ **Emitted by:** `sandbox` (once approved by the user)
4
+ **Received by:** `product-planning`
5
+ **Objective:** Turn the direction approved during Sandbox into a deliverable structure (squares/sub-squares โ†’ Epic/Feature/Story).
6
+
7
+ ## Before emitting, confirm
8
+
9
+ - A Discovery Doc was created in Allye (`doc_create`, location confirmed with the user against `doc_full_tree`) โ€” this handover references it, it does not duplicate its content.
10
+ - Every path that was explored and abandoned is listed with *why* โ€” the next chat should never accidentally re-propose a rejected direction.
11
+ - Research findings (if any) are summarized with enough detail to act on, not just "found some stuff."
12
+
13
+ ## Template
14
+
15
+ ```markdown
16
+ ## ๐Ÿ”„ Allye Handover โ€” discovery-to-planning
17
+ **Skill to load:** product-planning
18
+
19
+ ### Objective
20
+ {one sentence: which product/objective is being planned}
21
+
22
+ ### Discovery Doc
23
+ - Title: {doc title}
24
+ - Reference in Allye: {doc id or path in the tree}
25
+
26
+ ### Approved direction
27
+ {synthesis of what was decided in Sandbox โ€” what and why}
28
+
29
+ ### Paths explored and rejected
30
+ - {path A} โ€” rejected because {reason}
31
+ - {path B} โ€” rejected because {reason}
32
+
33
+ ### Research findings
34
+ {summary of what deep-search / code-analyzer brought back, with source โ€” "No research was done" if none}
35
+
36
+ ### Prototypes
37
+ {reference to generated artifacts, or "No prototype was made"}
38
+
39
+ ### Additional context
40
+ {anything else the next chat needs to know}
41
+
42
+ ---
43
+ If anything is unclear, STOP and ask โ€” don't proceed on a guess.
44
+ ```
@@ -0,0 +1,42 @@
1
+ # Handover: execution-report
2
+
3
+ **Emitted by:** `execution`
4
+ **Received by:** `orchestrator`
5
+ **Objective:** Return the implementation result โ€” what the Orchestrator uses to decide whether to dispatch the Reviewer or cascade status right away.
6
+
7
+ ## Before emitting, confirm
8
+
9
+ - Every task's status is reported per acceptance criterion, not as a blanket "done" โ€” the Orchestrator and the eventual Reviewer both need this granularity.
10
+ - Files changed are listed explicitly (not "various files") โ€” the Reviewer dispatch depends on this list.
11
+ - Open questions are surfaced here rather than silently assumed away โ€” this is the Executor's last chance to flag uncertainty before the chat ends.
12
+
13
+ ## Template
14
+
15
+ ```markdown
16
+ ## ๐Ÿ”„ Allye Handover โ€” execution-report
17
+ **Skill to load:** orchestrator
18
+
19
+ ### Story implemented
20
+ {STORY-KEY} โ€” {title}
21
+
22
+ ### Tasks and status per acceptance criterion
23
+ - {TASK-KEY}: {โœ… done | โš ๏ธ partial | โŒ blocked}
24
+ - {criterion 1}: {met | not met โ€” why}
25
+ - {criterion 2}: {met | not met โ€” why}
26
+
27
+ ### Files changed
28
+ - {path} โ€” {what changed}
29
+ - {path} โ€” {what changed}
30
+
31
+ ### Tests added
32
+ {which, what they cover, or "No test was needed โ€” reason"}
33
+
34
+ ### New decisions made during implementation
35
+ - {decision} โ€” {rationale}, or "No new decision"
36
+
37
+ ### Open questions
38
+ {anything that stayed unanswered and needs a human decision, or "None"}
39
+
40
+ ---
41
+ If anything is unclear, STOP and ask โ€” don't proceed on a guess.
42
+ ```
@@ -0,0 +1,42 @@
1
+ # Handover: planning-to-technical
2
+
3
+ **Emitted by:** `product-planning`
4
+ **Received by:** `technical-planning`
5
+ **Objective:** Technically detail the squares (Features) and sub-squares (Stories) approved in the business phase.
6
+
7
+ ## Before emitting, confirm
8
+
9
+ - Every Epic/Feature/Story key is real (created via `work_create`/`work_bulk_create` or found via `work_list`) โ€” never a placeholder key.
10
+ - Reused items and newly created items are explicitly distinguished โ€” the next chat should never have to guess which is which.
11
+ - The `Doc:` line is filled in: if a Discovery Doc exists upstream (from a `discovery-to-planning` handover), carry its reference here; if none, write "Nenhum doc adicional" explicitly โ€” don't leave the line out.
12
+ - Any key business decision made during Product Planning (scope cuts, explicit user choices, priorities โ€” the ones saved as planning memories) is restated here, not just implied by the work item descriptions. This section is best-effort and often short or empty: most locked decisions come later, from Technical Planning's own Discussion Phase โ€” don't pad it.
13
+
14
+ ## Template
15
+
16
+ ```markdown
17
+ ## ๐Ÿ”„ Allye Handover โ€” planning-to-technical
18
+ **Skill to load:** technical-planning
19
+
20
+ ### Objective
21
+ {which story or set of stories will be technically detailed now}
22
+
23
+ ### Required reading
24
+ - Doc: {title and reference of the Discovery Doc, or "No additional doc"}
25
+ - Epic: {KEY} โ€” {title} ({reused | created})
26
+ - Feature(s): {KEY} โ€” {title} ({reused | created})
27
+ - Story(ies) to plan now: {KEY} โ€” {title} ({reused | created})
28
+
29
+ ### Locked business decisions
30
+ - {decision 1} โ€” {rationale}
31
+ - {decision 2} โ€” {rationale}
32
+ {or "No locked business decision beyond the item descriptions"}
33
+
34
+ ### Prototypes
35
+ {reference, or "No prototype was made"}
36
+
37
+ ### Additional context
38
+ {}
39
+
40
+ ---
41
+ If anything is unclear, STOP and ask โ€” don't proceed on a guess.
42
+ ```
@@ -0,0 +1,74 @@
1
+ # Handover: story-execution
2
+
3
+ **Emitted by:** `orchestrator`
4
+ **Received by:** `execution`
5
+ **Objective:** Implement exactly **one** story โ€” never a whole feature, and always the **entire** story: all of its tasks, across all waves, in a single dispatch. This is the scoping rule the whole Orchestrator/Executor loop depends on: one dispatch = one whole story. There is no per-wave handover and no follow-up "next wave" handover โ€” the Executor works through the waves in order and reports back once, when the story is done.
6
+
7
+ ## Before emitting, confirm
8
+
9
+ - Exactly one story is named โ€” if the Orchestrator is tempted to hand off two stories "to save a round trip," it must not; that's a feature-level handover in disguise.
10
+ - **Every** task under that story is listed โ€” all of them, across all waves, not just the first wave โ€” with its acceptance criteria copied in **full** (not summarized, not just linked). The Executor's chat has no other context and will never receive a second handover for the rest of the story.
11
+ - Tasks are grouped by wave so the Executor knows the execution order, but the wave grouping is ordering information only โ€” it never shrinks the scope of the dispatch.
12
+ - **Constraints are referenced, not recopied.** Anything true of every story under this
13
+ feature โ€” the base branch, the test command, naming rules, the definition of done โ€” belongs
14
+ in one feature-level doc that each handover points at. Recopying it into every handover
15
+ creates as many places to drift as there are stories, and the drift is silent because each
16
+ copy looks authoritative.
17
+ - The story's **AFK/HITL label** is stated. It was derived at planning time from whether every
18
+ task carries a runnable verification command (see `verification-loop` ยง4). The Orchestrator
19
+ reads it to decide whether this story can go to an unattended pane โ€” omitting it forces a
20
+ guess about whether a human needs to be watching.
21
+
22
+ ## Template
23
+
24
+ ```markdown
25
+ ## ๐Ÿ”„ Allye Handover โ€” story-execution
26
+ **Skill to load:** execution
27
+
28
+ ### Objective
29
+ Implement {STORY-KEY} โ€” {story title}
30
+
31
+ ### Story
32
+ ### Dispatch label
33
+ {AFK โ€” every task has a runnable verification command | HITL โ€” {TASK-KEY} declares verification: manual}
34
+ - Key: {STORY-KEY}
35
+ - Acceptance criteria: {copied from the story description}
36
+
37
+ ### Tasks (every task in the story, grouped by wave)
38
+ - Wave 1:
39
+ - {TASK-KEY} โ€” {title}
40
+ - Acceptance criteria: {copied in full from the task description}
41
+ - {TASK-KEY} โ€” {title}
42
+ - Acceptance criteria: {copied in full from the task description}
43
+ - Wave 2:
44
+ - {TASK-KEY} โ€” {title}
45
+ - Acceptance criteria: {copied in full from the task description}
46
+
47
+ ### Applicable locked decisions
48
+ - {decision} โ€” {rationale}
49
+
50
+ ### Constraints
51
+ Reference to the feature's constraints doc in Allye โ€” read it, do not expect it summarised here.
52
+ {doc title and id, or "No constraints doc โ€” follow existing conventions in the code"}
53
+
54
+ ### TDD expectation
55
+ {whether Red-Green-Refactor applies and why, or why it doesn't}
56
+
57
+ ---
58
+ Read ONLY this story and these tasks. Execute the waves in the listed order.
59
+
60
+ **If anything is unclear, STOP and ask โ€” don't proceed on a guess.**
61
+
62
+ **If anything is contradictory, STOP and report it.** A step that is perfectly clear and
63
+ impossible is a different failure from an ambiguous one, and the more dangerous: it can be
64
+ satisfied by quietly weakening whatever it conflicts with. Two criteria that cannot both
65
+ hold, a task requiring what another forbids โ€” report both halves, quoted, and resolve
66
+ neither.
67
+
68
+ **Report what is wrong but out of scope โ€” do not fix it.** A defect you notice while working
69
+ on something else is worth more reported than silently repaired, because a silent repair
70
+ hides a decision that was never made.
71
+
72
+ **Do not report "no issues" to be agreeable.** A conflict named is worth more than a clean
73
+ report. If two rules genuinely disagreed and you chose one, say which and why.
74
+ ```
@@ -0,0 +1,45 @@
1
+ # Handover: technical-to-orchestration
2
+
3
+ **Emitted by:** `technical-planning`
4
+ **Received by:** `orchestrator`
5
+ **Objective:** Drive delivery of the planned scope โ€” a feature, or a whole epic when the user chooses to group the handover by epic. This is the most "loaded" handover: the Orchestrator has no business or architecture context beyond what's here.
6
+
7
+ ## Before emitting, confirm
8
+
9
+ - The full reading list is spelled out โ€” doc, epic, feature(s), every story, every task, grouped by wave. "Read the feature" is not acceptable; list the actual keys.
10
+ - **The read instruction is explicit, not implied.** The handover must tell the receiver to read the entire subtree under the parent item (`work_get` + recursive `work_children`, descriptions included) and to open every referenced doc โ€” a list of keys without that instruction invites skimming.
11
+ - Every locked architecture/stack decision is restated โ€” the Orchestrator must never re-open these while dispatching Executor.
12
+ - Wave structure matches what Technical Planning actually produced (don't invent an ordering here โ€” copy it).
13
+
14
+ ## Template
15
+
16
+ ```markdown
17
+ ## ๐Ÿ”„ Allye Handover โ€” technical-to-orchestration
18
+ **Skill to load:** orchestrator
19
+
20
+ ### Objective
21
+ Drive delivery of {PARENT-KEY} โ€” {feature or epic title}
22
+
23
+ ### Required reading
24
+ Read ALL work items under {PARENT-KEY} via `work_get` + `work_children` (recursively, down to the tasks), including descriptions โ€” the list below is a checklist to verify against, not a substitute for reading. Also open every referenced doc before dispatching any story.
25
+
26
+ - Doc: {title and reference, or "No additional doc"}
27
+ - Epic: {EPIC-KEY}
28
+ - Feature(s): {FEATURE-KEY}
29
+ - Stories and tasks by wave:
30
+ - {STORY-KEY} โ€” {title}
31
+ - Wave 1: {TASK-KEY}, {TASK-KEY}
32
+ - Wave 2: {TASK-KEY}
33
+ - {STORY-KEY} โ€” {title}
34
+ - Wave 1: {TASK-KEY}
35
+
36
+ ### Locked architecture decisions
37
+ - {decision} โ€” {rationale}
38
+ - {decision} โ€” {rationale}
39
+
40
+ ### Additional context
41
+ {}
42
+
43
+ ---
44
+ If anything is unclear, STOP and ask โ€” don't proceed on a guess.
45
+ ```
@@ -0,0 +1,323 @@
1
+ ---
2
+ name: memory-protocol
3
+ description: Complete memory protocol for AI agents using Allye. Defines when and how to search, save, and link memories for cross-session continuity.
4
+ version: "2.3"
5
+ category: methodology
6
+ ---
7
+
8
+ # Allye Memory Protocol
9
+
10
+ Memories are how context survives between conversations. Without them, every session starts from zero โ€” decisions get repeated, context gets lost, and work gets duplicated.
11
+
12
+ This skill defines the complete protocol for using Allye's memory system (`memory_save`, `memory_search`, and the graph/relocation tools built on top of them).
13
+
14
+ ---
15
+
16
+ ## 1. How the memory system works
17
+
18
+ Allye ranks results by **semantic similarity**, not keyword matching โ€” write queries like you're asking a colleague ("what approach did we choose for handling file uploads"), not searching a database ("file upload decision PROJ-123 architecture storage").
19
+
20
+ ### Memory sectors
21
+
22
+ Every memory belongs to one of 7 sectors. **Always pass `sector` when saving** โ€” omit it and the server defaults to `knowledge`.
23
+
24
+ | Sector | Holds | Use it for |
25
+ |--------|---------------|------------|
26
+ | `decisions` | Technical/product decisions and trade-offs, with rationale | "We chose X over Y because..." |
27
+ | `sessions` | Session state and handovers | End-of-session continuity snapshots |
28
+ | `patterns` | Reusable patterns and conventions | "Services in this codebase follow..." |
29
+ | `incidents` | Bugs, blockers, regressions | "Deploy broke because..." |
30
+ | `plans` | Plans and roadmaps | Action plans, milestones, next steps |
31
+ | `knowledge` | Reusable learnings and background context (**default**) | Insights, findings, non-obvious constraints |
32
+ | `preferences` | Personal preferences | "User prefers conventional commits" โ€” auto-pinned, exempt from decay |
33
+
34
+ **Scope follows the sector โ€” never pass one explicitly:**
35
+
36
+ - **Personal** (visible only to you): `sessions`, `preferences`
37
+ - **Team** (shared with the active team): `decisions`, `incidents`, `plans`, `patterns`, `knowledge`
38
+
39
+ Search covers the union of your personal memories and the active team's โ€” never all teams. A team-sector save without a usable active team falls back to personal scope automatically; the save never fails on scope.
40
+
41
+ `sessions` being personal-only is what makes it the landing zone for raw session consolidation (ยง4) โ€” nothing durable or team-relevant should stay parked there. The mining step of the /save protocol (ยง4, Step 2) exists to read a `sessions` memory and decide, sector by sector, what graduates to team knowledge.
42
+
43
+ ### Conflict resolution โ€” not auto-dedup
44
+
45
+ Every `memory_save` passes through conflict resolution: Allye checks for similar existing memories and a resolver decides the outcome, never a blind "too similar โ†’ reject." Every save resolves to exactly one of four outcomes โ€” `created`, `updated`, `superseded`, `noop` โ€” and ยง4 Step 3 covers how to react to each.
46
+
47
+ ---
48
+
49
+ ## 2. When to search
50
+
51
+ ### Conversation start (mandatory)
52
+
53
+ <EXTREMELY_IMPORTANT>
54
+ At the start of EVERY conversation, run at least these searches before doing anything else:
55
+
56
+ 1. `memory_search(query: "Session State")` โ€” find where the user left off
57
+ 2. `memory_search(query: "{topic of user's request}")` โ€” find relevant context
58
+ 3. `memory_search(query: "{work item key}")` โ€” if a specific item is mentioned (e.g., "PROJ-123")
59
+ </EXTREMELY_IMPORTANT>
60
+
61
+ React to what you find: session state โ†’ summarize it for the user ("Last time we were working on X, you completed Y, and the next step was Z"); decisions โ†’ keep them in mind and respect locked ones; nothing โ†’ proceed, noting this is a fresh context.
62
+
63
+ ### Before decisions and implementation
64
+
65
+ | Moment | Search | Why |
66
+ |---|---|---|
67
+ | Before choosing an approach | `memory_search(query: "decision {topic}")`, `memory_search(query: "architecture {component}")` | Surfaces prior decisions โ€” some are **locked** (explicitly chosen by the user); deviating from a locked decision **must** be discussed with the user first |
68
+ | Before writing code for a task | `memory_search(query: "{task key} implementation")`, `memory_search(query: "{feature name} context")` | Surfaces constraints, dependencies, and past learnings that affect the current work |
69
+
70
+ ---
71
+
72
+ ## 3. When to save
73
+
74
+ ### Save shapes
75
+
76
+ Every save follows the same call, varying only sector, title prefix, content headers, and tags:
77
+
78
+ ```
79
+ memory_save(
80
+ title: "{prefix} โ€” {short description}",
81
+ content: "## {header 1}\n{...}\n\n## {header 2}\n{...}",
82
+ tags: [...],
83
+ sector: "{sector}"
84
+ )
85
+ ```
86
+
87
+ <!-- adapted from mattpocock/skills writing-great-skills (MIT): duplication cure โ€” one template plus a variant table, instead of four repeated call blocks -->
88
+
89
+ | Save when | Title prefix | Sector | Content headers | Tags |
90
+ |---|---|---|---|---|
91
+ | A technical decision is made | `Decision` | `decisions` | Decision / Why / Alternatives rejected / Classification (`locked` or `agent-discretion`) | `decision`, `{work-item-key}`, `{topic}` |
92
+ | Trade-offs between approaches are evaluated | `Trade-off` | `decisions` | Options / Analysis / Chosen | `trade-off`, `{work-item-key}`, `{topic}` |
93
+ | Something blocks progress | `Blocker` | `incidents` | Blocker / Impact / Possible resolutions | `blocker`, `{work-item-key}` |
94
+ | A non-obvious discovery would be lost between sessions | `Context` | `knowledge` | What / Why it matters | `context`, `{work-item-key}`, `{topic}` |
95
+
96
+ Save decisions and blockers immediately โ€” not batched at session end. **Locked** means the user explicitly chose it, and it stands until the user approves a change. **Agent-discretion** means the agent chose it, and it can be revisited if circumstances change.
97
+
98
+ ### Session state โ€” handled by the /save protocol
99
+
100
+ <EXTREMELY_IMPORTANT>
101
+ Before the conversation ends (or whenever /save is invoked), run the full /save protocol in ยง4. Session state is not a single ad hoc save โ€” it's the first of four coordinated steps that also promote durable knowledge from the session into team sectors.
102
+ </EXTREMELY_IMPORTANT>
103
+
104
+ ---
105
+
106
+ ## 4. The /save protocol
107
+
108
+ `/save` is a 4-step protocol that turns a session's raw activity into (a) a personal continuity snapshot and (b) correctly-scoped, durable team knowledge. Run all four steps, in order, every time /save is invoked or a conversation is about to end.
109
+
110
+ ### Step 1 โ€” Consolidate the session (sector: `sessions`, personal)
111
+
112
+ Save exactly ONE memory that summarizes the whole session:
113
+
114
+ ```
115
+ memory_save(
116
+ title: "Session State โ€” {WORK-KEY} {short description}",
117
+ content: "## Current position\n{phase: planning/development/review/delivery}\n{current task/story}\n\n## Work completed\n- {item 1}\n- {item 2}\n\n## Decisions made\n- {decision 1} [locked|agent-discretion]\n- {decision 2} [locked|agent-discretion]\n\n## Blockers\n- {blocker or 'None'}\n\n## Next concrete step\n{exactly what to do when resuming โ€” be specific}",
118
+ tags: ["session-state", "{work-item-key}", "{current-phase}"],
119
+ sector: "sessions"
120
+ )
121
+ ```
122
+
123
+ This memory is the raw material for Step 2 โ€” write it richly (real decisions, real blockers, real next steps). A vague consolidation yields nothing worth promoting.
124
+
125
+ ### Step 2 โ€” Mine the consolidation for promotable knowledge (team sectors, agent discretion)
126
+
127
+ Re-read the Step 1 content and ask: **is any of this still true and useful outside this conversation?**
128
+
129
+ Promote when the content is:
130
+ - A **decision** with rationale the next session needs to respect โ†’ `decisions`
131
+ - A **bug, regression, or blocker** with a real cause (not just "task was slow") โ†’ `incidents`
132
+ - A **plan or roadmap step** that outlives this session โ†’ `plans`
133
+ - A **reusable convention or pattern** discovered or confirmed while working โ†’ `patterns`
134
+ - A **non-obvious constraint or insight** that would surprise someone starting fresh โ†’ `knowledge`
135
+
136
+ Skip anything that just restates the diff/commit, routine progress with no durable lesson, content an existing team memory already covers (search before promoting, same as any save), or content that only makes sense inside this specific conversation.
137
+
138
+ Each promoted item is its own `memory_save` call โ€” one topic per memory, sector matched to content type, tags per ยง5. A session with zero promotable content is normal; don't force a promotion just to have one.
139
+
140
+ ### Step 3 โ€” React to the outcome
141
+
142
+ Both the Step 1 consolidation and every Step 2 promotion resolve to one of the four outcomes from ยง1. React accordingly โ€” none of these is an error to work around:
143
+
144
+ | Outcome | What happened | What you do |
145
+ |---------|---------------|--------------|
146
+ | `created` | No meaningful overlap found; a new memory was created | Nothing โ€” proceed |
147
+ | `updated` | Existing memory was close enough to aggregate; it was updated in place | Nothing โ€” the existing memory now holds both old and new content |
148
+ | `superseded` | New content invalidates the old; a new memory was created and the old one marked superseded (not deleted) | Nothing โ€” expected when a decision changes or a plan is revised |
149
+ | `noop` | Content is already fully covered; nothing was written | Stop. Use the returned existing memory as the source of truth instead of rewording and retrying |
150
+
151
+ Rewording the same content to force past a `noop` means the content wasn't new โ€” trust the resolver.
152
+
153
+ ### Step 4 โ€” Promote surviving todos (`productivity`, personal)
154
+
155
+ Some agents keep a scratch task list for the turn โ€” read the file, run the test, commit.
156
+ It is the right tool for that and it dies with the session, which is also right.
157
+
158
+ Ask the same question Step 2 asks of the session: **would this still matter tomorrow?**
159
+
160
+ **Promote when the item is:**
161
+ - A follow-up nobody has scheduled โ€” "the migration needs a rollback path before it ships"
162
+ - A discovery that costs time every time it is rediscovered โ€” "the app build fails without an
163
+ explicit install because the runtime is at a non-default path"
164
+ - Work the session surfaced but deliberately did not do
165
+
166
+ **Do NOT promote:**
167
+ - Any step of the work just completed. "Run the tests" is not a TODO, it is a thing that happened.
168
+ - Anything already captured as a work item โ€” `productivity` is personal follow-up, not a
169
+ second work tracker. If it belongs to a story, it belongs in the story.
170
+
171
+ ```
172
+ todo_create(
173
+ title: "{the follow-up, stated as an outcome}",
174
+ content: "## What\n{what needs doing}\n\n## Why it surfaced\n{the session context that produced it}",
175
+ priority: "{low|medium|high|urgent}"
176
+ )
177
+ ```
178
+
179
+ Zero promotions is the normal outcome. A session whose every scratch item was a step of the
180
+ work it just finished has nothing to promote, and forcing one turns a personal list of real
181
+ commitments into a log of completed steps โ€” which is what makes such lists get ignored.
182
+
183
+ ---
184
+
185
+ ## 5. Tag conventions
186
+
187
+ Consistent tags keep memories findable.
188
+
189
+ ### Phase
190
+
191
+ | Tag | When |
192
+ |-----|-------------|
193
+ | `planning` | During product or technical planning |
194
+ | `development` | During implementation |
195
+ | `review` | During code review |
196
+ | `delivery` | During finalization and delivery |
197
+
198
+ ### Work item
199
+
200
+ Use the key as-is (`PROJ-123`, `FEAT-45`, `TASK-67`); for hierarchical context, prefix with type: `epic:PROJ-100`, `feature:PROJ-110`, `story:PROJ-123`.
201
+
202
+ ### Topic
203
+
204
+ | Tag | Domain |
205
+ |-----|--------|
206
+ | `architecture` | System design, patterns, structure |
207
+ | `api-design` | API contracts, endpoints, schemas |
208
+ | `database` | Schema, migrations, queries |
209
+ | `testing` | Test strategy, coverage, fixtures |
210
+ | `performance` | Optimization, benchmarks, profiling |
211
+ | `security` | Auth, permissions, vulnerabilities |
212
+ | `deployment` | CI/CD, infrastructure, environments |
213
+ | `dependencies` | Third-party libraries, version management |
214
+ | `breaking-changes` | Changes that affect existing behavior |
215
+
216
+ ### Content type
217
+
218
+ | Tag | Marks |
219
+ |-----|---------------|
220
+ | `decision` | A choice that was made with rationale |
221
+ | `trade-off` | An evaluated comparison between options |
222
+ | `blocker` | Something preventing progress |
223
+ | `context` | Background information or insight |
224
+ | `session-state` | End-of-session continuity snapshot |
225
+
226
+ ---
227
+
228
+ ## 6. Search strategies
229
+
230
+ | Strategy | Use when | Example |
231
+ |---|---|---|
232
+ | Broad discovery | Not sure what exists | `memory_search(query: "{general topic}", limit: 10)` |
233
+ | Targeted retrieval | You know what you're looking for | `memory_search(query: "Decision โ€” authentication middleware for {project}")` |
234
+ | Multi-angle | Complex topics โ€” run several searches | `memory_search(query: "Session State PROJ-123")`, then `memory_search(query: "decision PROJ-123")`, then `memory_search(query: "architecture {module name}")` |
235
+
236
+ ---
237
+
238
+ ## 7. Anti-patterns
239
+
240
+ | Anti-pattern | Problem | Do this instead |
241
+ |-------------|---------|-----------------|
242
+ | Saving every small change | Noise drowns out signal | Save decisions, trade-offs, blockers, and session state โ€” not trivial details |
243
+ | Using vague titles | Hard to find later | Be specific: "Decision โ€” use PostgreSQL JSONB for dynamic fields" not "Database decision" |
244
+ | Saving implementation details | Code is the source of truth for code | Save the *why*, not the *what* |
245
+ | Not searching before saving | Creates near-duplicates that conflict resolution then has to untangle | Search first, then save |
246
+ | Giant memory dumps | Hard to search, and content is capped at 10000 characters | One topic per memory |
247
+
248
+ ---
249
+
250
+ ## 8. Graph traversal
251
+
252
+ The memory graph connects memories through explicit relation edges created at save time. Use it to find related context semantic search misses.
253
+
254
+ | Tool | Use when |
255
+ |----------|----------|
256
+ | `memory_search(query)` | You know *what* you're looking for |
257
+ | `memory_graph(memory_id, depth: 2)` | You have an ID and want to explore its neighborhood |
258
+ | `memory_relations(memory_id)` | A quick 1-hop check of a specific memory |
259
+ | `memory_search(query, include_graph: true)` | Search + graph context in one call |
260
+
261
+ **Context recovery.** At session start, after finding the session state memory: `memory_search(query: "Session State {work key}")` to get its ID, then `memory_graph(memory_id: "{id}", depth: 2)` to explore connected decisions, trade-offs, and blockers from past sessions.
262
+
263
+ **Decision cluster.** `memory_graph(memory_id: "{decision memory ID}", depth: 2, relation_types: ["extends", "depends_on", "supersedes"])`.
264
+
265
+ **Reading results.** Depth 0 is the root memory; depth 1 is directly connected; depth 2+ is transitive and can grow fast โ€” bound it with `relation_types` or `graph_limit`. `relation_types` is a free-form string, not a fixed enum โ€” `extends`, `depends_on`, and `supersedes` are examples, not the full set.
266
+
267
+ **On a 408 timeout** from `memory_graph` or `memory_relations`: reduce `depth` (try 1), add `relation_types` to narrow traversal, or add `graph_limit` to cap nodes returned.
268
+
269
+ ---
270
+
271
+ ## 9. Relocation flow (opt-in, one-time)
272
+
273
+ Before F1 shipped sector/scope, memories had neither concept. The backfill that introduced them landed every pre-existing memory as `scope: personal, sector: knowledge` โ€” a safe default, not necessarily the right one. Some of that content is really team knowledge (a decision, a pattern, an incident) that predates the sector system and never got the chance to be shared.
274
+
275
+ The relocation flow surfaces that backlog and offers to promote it โ€” **once per user, with explicit consent, never forced.**
276
+
277
+ ### When to offer it
278
+
279
+ Offer at most once per user, ever โ€” not once per session. A good moment is early in a session, right after the mandatory memory searches (ยง2), at a natural pause before the actual task. Never interrupt an in-progress task to offer this; if the user is mid-implementation or mid-debugging, wait for a natural break or skip it for that session โ€” it isn't urgent, and it'll still be there next time unless already offered.
280
+
281
+ ### Check the guard first
282
+
283
+ ```
284
+ memory_relocation_candidates(limit: 20)
285
+ ```
286
+
287
+ Read `alreadyPrompted` in the response:
288
+
289
+ - `true` โ†’ stop. The user already went through this flow or dismissed it โ€” don't mention it, this session or any future one.
290
+ - `false` and `candidates` empty โ†’ nothing to offer; don't mention the flow.
291
+ - `false` and `candidates` non-empty โ†’ make the offer below.
292
+
293
+ ### Make the offer
294
+
295
+ Summarize what was found in plain language, using each candidate's `suggestedSector` / `suggestedScope` / `confidence` as a starting point โ€” the suggestion is not a decision, the user reviews and can pick a different sector per item or skip items entirely:
296
+
297
+ > "I found {N} memories from before the team/sector system existed, all currently marked personal. A few of these look like they might belong to the team โ€” for example '{title}' looks like a `{suggestedSector}`. Want to review them and decide which ones to share with the team? This is a one-time thing, I won't ask again."
298
+
299
+ ### Apply the user's choices
300
+
301
+ Once the user has told you which candidates to promote (and to which sector, if overriding the suggestion), call `memory_relocation_apply` with exactly that approved subset โ€” never a batch "promote everything":
302
+
303
+ ```
304
+ memory_relocation_apply(relocations: [
305
+ { memoryId: "{id}", sector: "{approved sector}" }
306
+ ])
307
+ ```
308
+
309
+ Report the per-item outcome:
310
+
311
+ | Outcome | What happened | Tell the user |
312
+ |---------|---------------|------------------------|
313
+ | `relocated` | Moved to team scope, no conflict | "Moved to the team." |
314
+ | `merged` | Aggregated (non-destructively) into an existing team memory | "The team already had something similar โ€” merged into that instead of duplicating." |
315
+ | `superseded` | Promoted memory replaces an outdated team memory | "This replaces an older team memory that's now out of date." |
316
+ | `noop` | Team already fully knows this โ€” nothing duplicated | "The team already knew this โ€” nothing new to add." |
317
+ | `skipped` | No usable team, or already relocated | "Couldn't move this one โ€” {reason}." |
318
+
319
+ `memory_relocation_apply` sets the one-time marker as soon as it runs, even for a partial batch โ€” the user need not review every candidate in one pass. Unapproved candidates simply remain personal; that's a valid outcome, not a half-finished state to chase.
320
+
321
+ ### If the user declines
322
+
323
+ Call `memory_relocation_dismiss()` โ€” this sets the same one-time marker a completed apply would, so the flow is never offered again. An explicit decline still needs the marker set; silence or a topic change doesn't substitute for the call.