allye-pi 1.7.1 → 2.0.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.
Files changed (53) hide show
  1. package/README.md +73 -310
  2. package/bootstrap/allye.md +30 -0
  3. package/docs/install-omp.md +31 -0
  4. package/docs/install-pi.md +21 -117
  5. package/package.json +10 -4
  6. package/packages/allye-pi/src/index.ts +88 -782
  7. package/skills/bridge/SKILL.md +105 -0
  8. package/skills/bridge/references/crew.md +20 -0
  9. package/skills/bridge/references/delegation.md +174 -0
  10. package/skills/bridge/references/discovery.md +71 -0
  11. package/skills/bridge/references/publish.md +90 -0
  12. package/skills/bridge/references/state-contract.md +109 -0
  13. package/skills/bridge/references/workflow.md +132 -0
  14. package/skills/bridge-architect/SKILL.md +96 -0
  15. package/skills/bridge-architect/references/spec-template.md +90 -0
  16. package/skills/bridge-armorer/SKILL.md +103 -0
  17. package/skills/bridge-copilot/SKILL.md +74 -0
  18. package/skills/bridge-dispatcher/SKILL.md +96 -0
  19. package/skills/bridge-dispatcher/references/spec-template-minimal.md +53 -0
  20. package/skills/bridge-medic/SKILL.md +81 -0
  21. package/skills/bridge-optimizer/SKILL.md +68 -0
  22. package/skills/bridge-pilot/SKILL.md +69 -0
  23. package/skills/bridge-pilot/references/mocking.md +57 -0
  24. package/skills/bridge-pilot/references/tdd.md +42 -0
  25. package/skills/bridge-pilot/references/tests.md +60 -0
  26. package/skills/bridge-recon/SKILL.md +82 -0
  27. package/skills/bridge-shield/SKILL.md +73 -0
  28. package/skills/bridge-strategist/SKILL.md +92 -0
  29. package/skills/bridge-watcher/SKILL.md +73 -0
  30. package/skills/agent-runtime/SKILL.md +0 -129
  31. package/skills/agent-runtime/references/herdr.md +0 -184
  32. package/skills/board-progression/SKILL.md +0 -214
  33. package/skills/branch-landing/SKILL.md +0 -88
  34. package/skills/delivery/SKILL.md +0 -187
  35. package/skills/execution/SKILL.md +0 -396
  36. package/skills/handover-protocol/SKILL.md +0 -74
  37. package/skills/handover-protocol/references/correction.md +0 -32
  38. package/skills/handover-protocol/references/discovery-to-planning.md +0 -44
  39. package/skills/handover-protocol/references/execution-report.md +0 -42
  40. package/skills/handover-protocol/references/planning-to-technical.md +0 -42
  41. package/skills/handover-protocol/references/story-execution.md +0 -74
  42. package/skills/handover-protocol/references/technical-to-orchestration.md +0 -45
  43. package/skills/memory-protocol/SKILL.md +0 -319
  44. package/skills/orchestrator/SKILL.md +0 -249
  45. package/skills/product-planning/SKILL.md +0 -257
  46. package/skills/review/SKILL.md +0 -165
  47. package/skills/sandbox/SKILL.md +0 -62
  48. package/skills/setup/SKILL.md +0 -225
  49. package/skills/tdd-workflow/SKILL.md +0 -144
  50. package/skills/technical-planning/SKILL.md +0 -354
  51. package/skills/tools-quickref/SKILL.md +0 -308
  52. package/skills/using-allye/SKILL.md +0 -171
  53. package/skills/verification-loop/SKILL.md +0 -93
@@ -1,74 +0,0 @@
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
- ```
@@ -1,45 +0,0 @@
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
- ```
@@ -1,319 +0,0 @@
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 (proportional)
52
-
53
- For consequential, multi-step, resumed, or team-scoped work, search before acting:
54
-
55
- 1. `memory_search(query: "Session State")` — find where the user left off
56
- 2. `memory_search(query: "{topic of user's request}")` — find relevant context
57
- 3. `memory_search(query: "{work item key}")` — if a specific item is mentioned (e.g., "PROJ-123")
58
-
59
- For a short, low-risk, local request, the search may be skipped. Never claim a search was performed when the Allye memory capability is unavailable. React to what you find: session state → summarize it; decisions → respect locked ones; nothing → proceed with the available context.
60
-
61
- ### Before decisions and implementation
62
-
63
- | Moment | Search | Why |
64
- |---|---|---|
65
- | 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 |
66
- | 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 |
67
-
68
- ---
69
-
70
- ## 3. When to save
71
-
72
- ### Save shapes
73
-
74
- Every save follows the same call, varying only sector, title prefix, content headers, and tags:
75
-
76
- ```
77
- memory_save(
78
- title: "{prefix} — {short description}",
79
- content: "## {header 1}\n{...}\n\n## {header 2}\n{...}",
80
- tags: [...],
81
- sector: "{sector}"
82
- )
83
- ```
84
-
85
- <!-- adapted from mattpocock/skills writing-great-skills (MIT): duplication cure — one template plus a variant table, instead of four repeated call blocks -->
86
-
87
- | Save when | Title prefix | Sector | Content headers | Tags |
88
- |---|---|---|---|---|
89
- | A technical decision is made | `Decision` | `decisions` | Decision / Why / Alternatives rejected / Classification (`locked` or `agent-discretion`) | `decision`, `{work-item-key}`, `{topic}` |
90
- | Trade-offs between approaches are evaluated | `Trade-off` | `decisions` | Options / Analysis / Chosen | `trade-off`, `{work-item-key}`, `{topic}` |
91
- | Something blocks progress | `Blocker` | `incidents` | Blocker / Impact / Possible resolutions | `blocker`, `{work-item-key}` |
92
- | A non-obvious discovery would be lost between sessions | `Context` | `knowledge` | What / Why it matters | `context`, `{work-item-key}`, `{topic}` |
93
-
94
- 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.
95
-
96
- ### Session state — handled by the /save protocol
97
-
98
- When the session is consequential, resumed, or contains durable decisions, use the full /save protocol in §4 before ending. For short, low-risk, local work, saving may be skipped. If Allye persistence is unavailable, report that continuity was not saved rather than implying it was.
99
-
100
- ---
101
-
102
- ## 4. The /save protocol
103
-
104
- `/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, whenever the user explicitly invokes `/save` or when a consequential session is being closed. Do not force it for trivial local work.
105
-
106
- ### Step 1 — Consolidate the session (sector: `sessions`, personal)
107
-
108
- Save exactly ONE memory that summarizes the whole session:
109
-
110
- ```
111
- memory_save(
112
- title: "Session State — {WORK-KEY} {short description}",
113
- 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}",
114
- tags: ["session-state", "{work-item-key}", "{current-phase}"],
115
- sector: "sessions"
116
- )
117
- ```
118
-
119
- 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.
120
-
121
- ### Step 2 — Mine the consolidation for promotable knowledge (team sectors, agent discretion)
122
-
123
- Re-read the Step 1 content and ask: **is any of this still true and useful outside this conversation?**
124
-
125
- Promote when the content is:
126
- - A **decision** with rationale the next session needs to respect → `decisions`
127
- - A **bug, regression, or blocker** with a real cause (not just "task was slow") → `incidents`
128
- - A **plan or roadmap step** that outlives this session → `plans`
129
- - A **reusable convention or pattern** discovered or confirmed while working → `patterns`
130
- - A **non-obvious constraint or insight** that would surprise someone starting fresh → `knowledge`
131
-
132
- 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.
133
-
134
- 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.
135
-
136
- ### Step 3 — React to the outcome
137
-
138
- 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:
139
-
140
- | Outcome | What happened | What you do |
141
- |---------|---------------|--------------|
142
- | `created` | No meaningful overlap found; a new memory was created | Nothing — proceed |
143
- | `updated` | Existing memory was close enough to aggregate; it was updated in place | Nothing — the existing memory now holds both old and new content |
144
- | `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 |
145
- | `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 |
146
-
147
- Rewording the same content to force past a `noop` means the content wasn't new — trust the resolver.
148
-
149
- ### Step 4 — Promote surviving todos (`productivity`, personal)
150
-
151
- Some agents keep a scratch task list for the turn — read the file, run the test, commit.
152
- It is the right tool for that and it dies with the session, which is also right.
153
-
154
- Ask the same question Step 2 asks of the session: **would this still matter tomorrow?**
155
-
156
- **Promote when the item is:**
157
- - A follow-up nobody has scheduled — "the migration needs a rollback path before it ships"
158
- - A discovery that costs time every time it is rediscovered — "the app build fails without an
159
- explicit install because the runtime is at a non-default path"
160
- - Work the session surfaced but deliberately did not do
161
-
162
- **Do NOT promote:**
163
- - Any step of the work just completed. "Run the tests" is not a TODO, it is a thing that happened.
164
- - Anything already captured as a work item — `productivity` is personal follow-up, not a
165
- second work tracker. If it belongs to a story, it belongs in the story.
166
-
167
- ```
168
- todo_create(
169
- title: "{the follow-up, stated as an outcome}",
170
- content: "## What\n{what needs doing}\n\n## Why it surfaced\n{the session context that produced it}",
171
- priority: "{low|medium|high|urgent}"
172
- )
173
- ```
174
-
175
- Zero promotions is the normal outcome. A session whose every scratch item was a step of the
176
- work it just finished has nothing to promote, and forcing one turns a personal list of real
177
- commitments into a log of completed steps — which is what makes such lists get ignored.
178
-
179
- ---
180
-
181
- ## 5. Tag conventions
182
-
183
- Consistent tags keep memories findable.
184
-
185
- ### Phase
186
-
187
- | Tag | When |
188
- |-----|-------------|
189
- | `planning` | During product or technical planning |
190
- | `development` | During implementation |
191
- | `review` | During code review |
192
- | `delivery` | During finalization and delivery |
193
-
194
- ### Work item
195
-
196
- 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`.
197
-
198
- ### Topic
199
-
200
- | Tag | Domain |
201
- |-----|--------|
202
- | `architecture` | System design, patterns, structure |
203
- | `api-design` | API contracts, endpoints, schemas |
204
- | `database` | Schema, migrations, queries |
205
- | `testing` | Test strategy, coverage, fixtures |
206
- | `performance` | Optimization, benchmarks, profiling |
207
- | `security` | Auth, permissions, vulnerabilities |
208
- | `deployment` | CI/CD, infrastructure, environments |
209
- | `dependencies` | Third-party libraries, version management |
210
- | `breaking-changes` | Changes that affect existing behavior |
211
-
212
- ### Content type
213
-
214
- | Tag | Marks |
215
- |-----|---------------|
216
- | `decision` | A choice that was made with rationale |
217
- | `trade-off` | An evaluated comparison between options |
218
- | `blocker` | Something preventing progress |
219
- | `context` | Background information or insight |
220
- | `session-state` | End-of-session continuity snapshot |
221
-
222
- ---
223
-
224
- ## 6. Search strategies
225
-
226
- | Strategy | Use when | Example |
227
- |---|---|---|
228
- | Broad discovery | Not sure what exists | `memory_search(query: "{general topic}", limit: 10)` |
229
- | Targeted retrieval | You know what you're looking for | `memory_search(query: "Decision — authentication middleware for {project}")` |
230
- | 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}")` |
231
-
232
- ---
233
-
234
- ## 7. Anti-patterns
235
-
236
- | Anti-pattern | Problem | Do this instead |
237
- |-------------|---------|-----------------|
238
- | Saving every small change | Noise drowns out signal | Save decisions, trade-offs, blockers, and session state — not trivial details |
239
- | Using vague titles | Hard to find later | Be specific: "Decision — use PostgreSQL JSONB for dynamic fields" not "Database decision" |
240
- | Saving implementation details | Code is the source of truth for code | Save the *why*, not the *what* |
241
- | Not searching before saving | Creates near-duplicates that conflict resolution then has to untangle | Search first, then save |
242
- | Giant memory dumps | Hard to search, and content is capped at 10000 characters | One topic per memory |
243
-
244
- ---
245
-
246
- ## 8. Graph traversal
247
-
248
- The memory graph connects memories through explicit relation edges created at save time. Use it to find related context semantic search misses.
249
-
250
- | Tool | Use when |
251
- |----------|----------|
252
- | `memory_search(query)` | You know *what* you're looking for |
253
- | `memory_graph(memory_id, depth: 2)` | You have an ID and want to explore its neighborhood |
254
- | `memory_relations(memory_id)` | A quick 1-hop check of a specific memory |
255
- | `memory_search(query, include_graph: true)` | Search + graph context in one call |
256
-
257
- **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.
258
-
259
- **Decision cluster.** `memory_graph(memory_id: "{decision memory ID}", depth: 2, relation_types: ["extends", "depends_on", "supersedes"])`.
260
-
261
- **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.
262
-
263
- **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.
264
-
265
- ---
266
-
267
- ## 9. Relocation flow (opt-in, one-time)
268
-
269
- 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.
270
-
271
- The relocation flow surfaces that backlog and offers to promote it — **once per user, with explicit consent, never forced.**
272
-
273
- ### When to offer it
274
-
275
- Offer at most once per user, ever — not once per session. A good moment is early in a consequential session, after any relevant 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. If the relocation capability is unavailable, do not present the flow.
276
-
277
- ### Check the guard first
278
-
279
- ```
280
- memory_relocation_candidates(limit: 20)
281
- ```
282
-
283
- Read `alreadyPrompted` in the response:
284
-
285
- - `true` → stop. The user already went through this flow or dismissed it — don't mention it, this session or any future one.
286
- - `false` and `candidates` empty → nothing to offer; don't mention the flow.
287
- - `false` and `candidates` non-empty → make the offer below.
288
-
289
- ### Make the offer
290
-
291
- 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:
292
-
293
- > "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."
294
-
295
- ### Apply the user's choices
296
-
297
- 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":
298
-
299
- ```
300
- memory_relocation_apply(relocations: [
301
- { memoryId: "{id}", sector: "{approved sector}" }
302
- ])
303
- ```
304
-
305
- Report the per-item outcome:
306
-
307
- | Outcome | What happened | Tell the user |
308
- |---------|---------------|------------------------|
309
- | `relocated` | Moved to team scope, no conflict | "Moved to the team." |
310
- | `merged` | Aggregated (non-destructively) into an existing team memory | "The team already had something similar — merged into that instead of duplicating." |
311
- | `superseded` | Promoted memory replaces an outdated team memory | "This replaces an older team memory that's now out of date." |
312
- | `noop` | Team already fully knows this — nothing duplicated | "The team already knew this — nothing new to add." |
313
- | `skipped` | No usable team, or already relocated | "Couldn't move this one — {reason}." |
314
-
315
- `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.
316
-
317
- ### If the user declines
318
-
319
- 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.