You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c4cfea3
Browse filesBrowse the repository at this point in the historyBrowse files
feat(skills): make /retrospective use the knowledge store this home is configured with (#42)
* feat(skills): make /retrospective use the knowledge store this home is configured with
The retrospective hard-coded PP Brain and its search_knowledge/add_knowledge
tools, so on a home whose org-wide store is the RAG it always marked the layer
unreachable and saved nothing there.
Extract the config/knowledge-store reader from fm-brief.sh into
bin/fm-knowledge-store-lib.sh, the one owner shared by fm-brief.sh and a new
read-only bin/fm-knowledge-store.sh that prints name, backend and search
instructions. An optional line 3 names the backend (rag or pp-brain); without
it the backend is derived from the MCP server line 2 names. The retrospective
now resolves the org store from it and takes its recall and write verbs from
reference.md per backend; approval gates are unchanged.
* no-mistakes(test): Fix retrospective skill code-root path hint depth
* no-mistakes(document): Add knowledge-store scripts to bin toolbelt inventory
* no-mistakes(lint): Silence SC2034 for FM_KS_* globals in knowledge-store lib
---------
Co-authored-by: Alan Domio <alan.domio@ai360.it>
`project` is a **known-inconsistent field** — the documentation and the live data have disagreed.
71
71
Call `memory_sessions()` first and reuse whatever identifier the current session was actually
72
-
registered under; if none exists, **omit it** rather than invent one. Detail: Brain `02a16f`.
72
+
registered under; if none exists, **omit it** rather than invent one. Detail, on a PP Brain home: item`02a16f`.
73
73
74
-
## PP Brain
74
+
## Org knowledge store
75
75
76
76
Company-wide, cross-repo, cross-machine, human-readable — the only layer a colleague can read.
77
+
Which store that is comes from `bin/fm-knowledge-store.sh read` (`SKILL.md`, "Resolve the org store first"); use only the section below that matches its `backend`.
78
+
Search before writing in every backend: the convention is to link, not fork.
77
79
78
-
- Search before writing. The convention is to link, not fork.
80
+
### `backend=rag` — the RAG (`rag_qdrant_server`)
81
+
82
+
- Recall: `query_rag_hybrid(query_text, user_roles)`, falling back to `query_rag` with the same arguments.
`metadata_json` is a JSON string and must carry `document_type`, one of `guida` | `policy` | `info` | `ticket`; any other value is rejected.
86
+
A retrospective learning is normally `info`, and a stable convention a colleague must follow is `guida`.
87
+
Also set `file_path` (a stable logical path such as `retrospective/<repo>/<slug>`), a `slug`, `tags`, and `document_date` (today), so the item is findable and linkable later.
88
+
`user_roles` sets who can read it; keep it internal (for example `admin,dev`), never public.
89
+
- The identifier to record in the report is the `slug` the call accepted, or whatever id it returned; no id back means the write is not claimed.
90
+
- Keep `chunk_text` focused with the key information first, and point at the canonical file rather than embedding it wholesale.
91
+
92
+
### `backend=pp-brain` — PP Brain
93
+
94
+
- Recall: `search_knowledge(query, prompt)`, with **both** fields populated.
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,7 @@ config/calm Pi Calm presentation preference; LOCAL, gitignored, and not inhe
74
74
config/startup-memory-budget primary-authoritative per-home startup-memory budget; LOCAL, gitignored, materialized as 7,500 estimated tokens by locked primary bootstrap and inherited into secondmate homes; see docs/configuration.md "Startup memory budget"
75
75
config/herdr-presentation-spaces optional "off" opt-out from, or "on" opt-in to, Herdr's default-on disposable single-task visual projection, which is unconfigured-default-on only at or above a Herdr version floor; LOCAL, gitignored; inherited by secondmate homes; see docs/herdr-backend.md "Presentation spaces"
76
76
config/trace-context optional presence flag enabling default-off native W3C trace-context propagation to spawned agents; LOCAL, gitignored; inherited by secondmate homes; see docs/configuration.md "Trace context propagation" and docs/trace-context.md
77
-
config/knowledge-store optional two-line knowledge-store name (line 1) and search-instructions clause (line 2)for generated crewmate briefs; LOCAL, gitignored; absent keeps bin/fm-brief.sh's historical upstream RAG wording; inherited by secondmate homes; see docs/configuration.md "Knowledge store naming (config/knowledge-store)"
77
+
config/knowledge-store optional knowledge-store name (line 1), search-instructions clause (line 2), and optional backend key (line 3) for generated crewmate briefs and /retrospective; LOCAL, gitignored; absent keeps bin/fm-brief.sh's historical upstream RAG wording; inherited by secondmate homes; see docs/configuration.md "Knowledge store naming (config/knowledge-store)"
78
78
config/cmux-socket-password optional cmux control-socket password; LOCAL, gitignored; read fresh on every cmux CLI call and passed through without ever overriding an operator's own ambient CMUX_SOCKET_PASSWORD when absent (docs/cmux-backend.md "Setup")
79
79
config/wedge-alarm optional away-mode wedge-alarm active-alert directives; LOCAL, gitignored; absent means auto (macOS Notification Center when available); see docs/wedge-alarm.md
80
80
config/skill-sync-exclude optional rsync --exclude patterns for the remote secondmate skill sync, one per non-empty, non-comment line; LOCAL, gitignored; absent uses the built-in default set; a remote-launch-only best-effort step outside the FM_INHERITABLE_CONFIG allowlist, NOT inherited by secondmate homes; see docs/configuration.md "Remote secondmate skill sync (config/skill-sync-exclude)"
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,7 +176,7 @@ Claude and grok use the slash form shown here; codex uses the same names with `$
176
176
|`/bearings`| Generate a concise four-section chat digest from bounded local fleet and registered-secondmate state; use `/bearings file` to also replace today's dated report in `data/`, and add `include PRs` when live PR enrichment is wanted |
177
177
|`/updatefirstmate`| Self-update the running firstmate and its secondmates to the latest from origin with fast-forward-only pulls, then re-read instructions and nudge secondmates |
178
178
|`/stow`| Sweep the session for uncaptured durable knowledge, persist the open work records this session knows are unfiled or now wrong, curate tiered startup memory with decay and cold archival, enforce each home's budget or surface the required decision, cascade to registered second mates, and report what is safe to reset |
179
-
|`/retrospective`| Analyze the active session, route durable learnings to CLAUDE.md/AGENTS.md, agentmemory, and PP Brain by blast radius, and write a dated report; see [`.agents/skills/retrospective/SKILL.md`](.agents/skills/retrospective/SKILL.md)|
179
+
|`/retrospective`| Analyze the active session, route durable learnings to CLAUDE.md/AGENTS.md, agentmemory, and the org-wide knowledge store this home is configured with (the RAG or PP Brain) by blast radius, and write a dated report; see [`.agents/skills/retrospective/SKILL.md`](.agents/skills/retrospective/SKILL.md)|
# Grounding wording is named by this home's optional config/knowledge-store
189
-
# (docs/configuration.md): line 1 is the store's name as it reads in worker
190
-
# text, line 2 is the search-instructions clause inserted in parentheses after
191
-
# it. A NONEXISTENT file keeps this script's historical upstream wording, so
192
-
# every home without the file gets a byte-identical brief; a PRESENT file
193
-
# (including a 0-byte one) that lacks either line is refused, since a silent
194
-
# default there would be exactly the unfollowable-instruction failure this
195
-
# setting exists to prevent. The existence check must not be a non-empty
196
-
# check (`-s`): a 0-byte file must hit the same refusal as a one-line file,
197
-
# not silently fall back to the default.
198
-
KS_NAME="the RAG"
199
-
# shellcheck disable=SC2016 # single quotes are deliberate: the backticks must stay literal
200
-
KS_INSTRUCTIONS='`query_rag_hybrid` or `query_rag` on the `rag_qdrant_server` MCP server, with `query_text` set and `user_roles` passed, empty if you have none'
201
-
KS_FILE="$FM_HOME/config/knowledge-store"
202
-
if [ -f"$KS_FILE" ];then
203
-
ks_name_line=$(sed -n '1p'"$KS_FILE")
204
-
ks_instructions_line=$(sed -n '2p'"$KS_FILE")
205
-
if [ -z"$ks_name_line" ] || [ -z"$ks_instructions_line" ];then
206
-
echo"error: $KS_FILE must have the store name on line 1 and search instructions on line 2">&2
207
-
exit 1
208
-
fi
209
-
KS_NAME=$ks_name_line
210
-
KS_INSTRUCTIONS=$ks_instructions_line
189
+
# (docs/configuration.md): bin/fm-knowledge-store-lib.sh owns reading it, the
190
+
# absent-file default, and the refusal of a present but malformed file.
# shellcheck disable=SC2034 # FM_KS_* fields are output globals for sourcing callers.
3
+
# Knowledge-store resolution primitives.
4
+
# Usage: . bin/fm-knowledge-store-lib.sh
5
+
#
6
+
# The optional local config/knowledge-store setting names the org-wide
7
+
# knowledge store this home's installed MCP servers actually provide
8
+
# (docs/configuration.md "Knowledge store naming"). This library is the one
9
+
# owner of reading it; bin/fm-brief.sh sources it for generated Grounding
10
+
# wording and bin/fm-knowledge-store.sh prints it for skills such as
11
+
# /retrospective.
12
+
#
13
+
# Line 1 is the store's name as it reads in agent-facing text, line 2 the
14
+
# search-instructions clause, and optional line 3 the backend key: `rag`
15
+
# (rag_qdrant_server) or `pp-brain`. Without line 3 the backend is derived
16
+
# from the MCP server line 2 names - `rag_qdrant_server` is `rag`,
17
+
# `pp-brain` or `search_knowledge` is `pp-brain` - and anything else is
18
+
# `other`, a store whose write contract is not known here.
19
+
# A NONEXISTENT file resolves to the historical upstream default, the RAG.
20
+
# A PRESENT file (including a 0-byte one) lacking line 1 or line 2, or carrying
21
+
# an unknown line-3 key, is refused rather than silently defaulted, since a
22
+
# silent default there is exactly the unfollowable-instruction failure the
23
+
# setting exists to prevent. The existence check must not be a non-empty
24
+
# check (`-s`): a 0-byte file must hit the same refusal as a one-line file.
25
+
26
+
FM_KS_FILE_NAME="knowledge-store"
27
+
FM_KS_NAME=""
28
+
FM_KS_INSTRUCTIONS=""
29
+
FM_KS_BACKEND=""
30
+
FM_KS_ERROR=""
31
+
32
+
# fm_knowledge_store_read <config-dir>
33
+
# Sets FM_KS_NAME, FM_KS_INSTRUCTIONS, and FM_KS_BACKEND; on refusal returns 1
34
+
# with FM_KS_ERROR set.
35
+
fm_knowledge_store_read() {
36
+
local file="$1/$FM_KS_FILE_NAME" name instructions backend
37
+
FM_KS_ERROR=""
38
+
FM_KS_NAME="the RAG"
39
+
# shellcheck disable=SC2016 # single quotes are deliberate: the backticks must stay literal
40
+
FM_KS_INSTRUCTIONS='`query_rag_hybrid` or `query_rag` on the `rag_qdrant_server` MCP server, with `query_text` set and `user_roles` passed, empty if you have none'
41
+
FM_KS_BACKEND="rag"
42
+
[ -f"$file" ] ||return 0
43
+
name=$(sed -n '1p'"$file")
44
+
instructions=$(sed -n '2p'"$file")
45
+
backend=$(sed -n '3p'"$file")
46
+
if [ -z"$name" ] || [ -z"$instructions" ];then
47
+
FM_KS_ERROR="$file must have the store name on line 1 and search instructions on line 2"
Copy file name to clipboardExpand all lines: docs/configuration.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,11 +151,13 @@ There is no shared learnings file by captain decision.
151
151
152
152
## Knowledge store naming (config/knowledge-store)
153
153
154
-
`bin/fm-brief.sh`'s Grounding section tells every generated ship and scout worker to search a knowledge store before its first substantive action and before working around any gotcha.
154
+
`bin/fm-brief.sh`'s Grounding section tells every generated ship and scout worker to search a knowledge store before its first substantive action and before working around any gotcha, and the internal [`/retrospective` skill](../.agents/skills/retrospective/SKILL.md) recalls from and, with approval, writes to the same store as its org-wide layer.
155
155
The optional local, gitignored `config/knowledge-store` names that store for a home whose installed MCP servers do not match the upstream default.
156
156
Line 1 is the store's name as it should read in worker-facing text (e.g. `PP Brain`); line 2 is the search-instructions clause inserted in parentheses right after the name (e.g. the exact MCP tool, its arguments, and any follow-up contract).
157
-
Either line present but blank, or the file present but empty, is refused rather than silently falling back.
158
-
Absent keeps this script's historical wording naming the RAG's `query_rag_hybrid`/`query_rag` tool on the `rag_qdrant_server` MCP server, byte-identical to briefs generated before this setting existed.
157
+
Optional line 3 is the backend key, `rag` or `pp-brain`, which tells `/retrospective` which write tools the store has; without it the backend is derived from the MCP server line 2 names (`rag_qdrant_server` is `rag`, `pp-brain` or `search_knowledge` is `pp-brain`), and any other store is `other`, recalled from but never written by the skill.
158
+
Either of the first two lines present but blank, the file present but empty, or an unknown line-3 key is refused rather than silently falling back.
159
+
Absent resolves to the RAG: briefs keep this script's historical wording naming the RAG's `query_rag_hybrid`/`query_rag` tool on the `rag_qdrant_server` MCP server, byte-identical to briefs generated before this setting existed, and `/retrospective` uses the `rag` backend.
160
+
`bin/fm-knowledge-store.sh read` prints the resolved `name`, `backend`, and `search` values; `bin/fm-knowledge-store-lib.sh` is the one reader both consumers share.
159
161
It is inherited into secondmate homes (`FM_INHERITABLE_CONFIG` in [`bin/fm-config-inherit-lib.sh`](../bin/fm-config-inherit-lib.sh)): a secondmate's own crewmates get generated briefs from the same code, so an uninherited setting would silently regress them to a knowledge store the home's MCP servers do not have installed, reproducing the same failure this setting exists to fix.
Copy file name to clipboardExpand all lines: docs/scripts.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,8 @@ The shared no-mistakes gate refusal for fleet lifecycle entrypoints is summarize
30
30
|`fm-captain-hold.sh`| Hold tasks for the captain, record the captain's answers, gate investigation completion, and report record divergence between the status log and the backlog |
0 commit comments