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 32d52c4
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,8 @@ If you use the user-level install, ensure your user Python bin is on `PATH`:
43
43
export PATH="$(python3 -m site --user-base)/bin:$PATH"
44
44
```
45
45
46
+
For Codex Desktop and similar tool shells, put both the PATH export and `SHELLBRAIN_DB_DSN` in `~/.zprofile`, not `~/.zshrc`, so non-interactive login shells can see them.
47
+
46
48
## Bootstrap
47
49
48
50
Export `SHELLBRAIN_DB_DSN` from your shell profile, then apply packaged migrations once:
export PATH="$(python3 -m site --user-base)/bin:$PATH"
28
28
```
29
29
30
+
For Codex Desktop and similar tool shells, put that PATH export and `SHELLBRAIN_DB_DSN` in `~/.zprofile`, not `~/.zshrc`, so non-interactive login shells can see them.
31
+
30
32
## Bootstrap
31
33
32
34
Set this once in your shell profile, then apply migrations:
Then use the same wrapper shape for real commands when needed:
50
+
51
+
```bash
52
+
zsh -lc "source ~/.zprofile >/dev/null 2>&1; shellbrain read --json '{\"query\":\"Have we seen this migration lock timeout before?\",\"kinds\":[\"problem\",\"solution\",\"failed_tactic\"]}'"
53
+
```
54
+
39
55
## Query First, But Query Precisely
40
56
41
57
Shellbrain `read` uses lexical retrieval plus semantic similarity. Query it with the concrete problem, subsystem, constraint, or decision you are working on. Do not start with vague prompts like "what should I know about this repo?"
- The read result already returns structured JSON with top-level sections:
168
204
-`meta`
@@ -178,7 +214,7 @@ This is worth exploring because a supervisor loop could reduce protocol entropy
178
214
- Keep `scenarios` explicitly deferred for now.
179
215
- Do not treat scenario lift as part of the current v1 output surface until it is intentionally reintroduced.
180
216
181
-
### 9. Retrieval Metadata and Usage Signals
217
+
### 10. Retrieval Metadata and Usage Signals
182
218
183
219
- Add lightweight metadata to every read result so behavior is inspectable without digging through logs.
184
220
- Useful fields to include:
@@ -197,7 +233,7 @@ This is worth exploring because a supervisor loop could reduce protocol entropy
197
233
- stale-shellbrain hit rate
198
234
- duplicate / near-duplicate retrieval rate
199
235
200
-
### 10. System Performance Metrics
236
+
### 11. System Performance Metrics
201
237
202
238
- Define a small metrics set that tells us whether the shellbrain setup is becoming more useful.
203
239
- Candidate metrics:
@@ -213,15 +249,15 @@ This is worth exploring because a supervisor loop could reduce protocol entropy
213
249
214
250
## Later Work
215
251
216
-
### 11. Episodes and Session Transfer Support
252
+
### 12. Episodes and Session Transfer Support
217
253
218
254
-`episodes` and `episode_events` are implemented and validated end to end.
219
255
- Remaining work is to operationalize the rest of the episodic model:
220
256
- wire `session_transfers` into real handoff flows
221
257
- add execution tests that prove transfer writes work against PostgreSQL
222
258
- decide how transfer events should participate in agent-facing analytics
223
259
224
-
### 12. Later: Local Model for Triage / Filtering
260
+
### 13. Later: Local Model for Triage / Filtering
225
261
226
262
- Consider a smaller local model ahead of the main model for cheap first-pass categorization or filtering.
227
263
- Possible uses:
@@ -231,7 +267,7 @@ This is worth exploring because a supervisor loop could reduce protocol entropy
231
267
- perform cheap reranking before the higher-cost model sees context
232
268
- Treat this as a later optimization after baseline metadata and metrics exist, so we can measure whether it actually improves quality, latency, or cost.
233
269
234
-
### 13. Usability: Batch Questions for Memory Reads
270
+
### 14. Usability: Batch Questions for Memory Reads
235
271
236
272
- Support a single shellbrain-read call that accepts multiple questions at once, instead of forcing the LLM into sequential reads.
237
273
- The goal is to let the model ask for "everything I need to know" in one interaction when it has several sub-questions.
@@ -243,7 +279,7 @@ This is worth exploring because a supervisor loop could reduce protocol entropy
243
279
- This should reduce extra tool turns and token burn caused by back-to-back shellbrain queries.
244
280
- Design the interface so batching is a first-class usability path, not just a thin wrapper around repeated single-question retrieval.
245
281
246
-
### 14. Later: Scenario Lift
282
+
### 15. Later: Scenario Lift
247
283
248
284
- Keep scenario lift out of the current v1 read output.
249
285
- Revisit it later as a separate project once the atomic-shellbrain path, metadata, and operational surface are stable.
@@ -253,7 +289,7 @@ This is worth exploring because a supervisor loop could reduce protocol entropy
Copy file name to clipboardExpand all lines: shellbrain/periphery/cli/main.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,10 @@ class _HelpFormatter(argparse.RawDescriptionHelpFormatter):
26
26
- `create` authors durable memories from that evidence.
27
27
- `update` records utility, truth-evolution links, and explicit associations.
28
28
29
+
Codex shell bootstrap:
30
+
- In Codex Desktop or similar tool shells, start via `zsh -lc 'source ~/.zprofile >/dev/null 2>&1; shellbrain --help'`.
31
+
- Use the same wrapper shape for actual Shellbrain commands when the session depends on machine-level PATH and `SHELLBRAIN_DB_DSN`.
32
+
29
33
Protocol:
30
34
1. Query with the concrete bug, subsystem, decision, or constraint you are working on.
31
35
Avoid generic prompts like "what should I know about this repo?"
@@ -37,6 +41,7 @@ class _HelpFormatter(argparse.RawDescriptionHelpFormatter):
37
41
- Shellbrain should already be available from a one-time global install.
38
42
- If it is missing, restore the machine-level install (`pipx install --editable /path/to/shellbrain` or `python3 -m pip install --user --break-system-packages --editable /path/to/shellbrain`).
39
43
- Export `SHELLBRAIN_DB_DSN` from your shell profile.
44
+
- In Codex Desktop or similar tool shells, put the PATH export and `SHELLBRAIN_DB_DSN` in `~/.zprofile`, not `~/.zshrc`.
40
45
- Run `shellbrain admin migrate` once against the target database.
41
46
42
47
Examples:
@@ -48,7 +53,8 @@ class _HelpFormatter(argparse.RawDescriptionHelpFormatter):
48
53
shellbrain admin migrate
49
54
50
55
Common recovery steps:
51
-
- `SHELLBRAIN_DB_DSN is not set`: export the database DSN before running the CLI.
56
+
- `shellbrain: command not found` inside Codex: verify you used the `zsh -lc 'source ~/.zprofile ...'` startup pattern before declaring Shellbrain blocked.
57
+
- `SHELLBRAIN_DB_DSN is not set`: verify the same startup pattern and that the export lives in `~/.zprofile`, then export the database DSN if needed.
52
58
- No active host session found: verify Codex/Claude Code transcript availability, then rerun `events`.
53
59
- Evidence ref rejected: rerun `events` and use the returned `episode_event` ids verbatim.
54
60
- Wrong working tree: rerun with `--repo-root` (and optionally `--repo-id`) for the target repo.
Copy file name to clipboardExpand all lines: skills/shellbrain-session-start/SKILL.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,8 +27,9 @@ Treat current repo state as ground truth. Treat Shellbrain as advisory long-term
27
27
28
28
## Quick Start
29
29
30
-
1. Check that Shellbrain is available with `shellbrain --help`.
31
-
2. Assume Shellbrain is already available from a one-time global install. If the CLI is missing, ask the operator to restore that machine-level install instead of reinstalling per repo. The operator should also have `SHELLBRAIN_DB_DSN` set and `shellbrain admin migrate` already applied.
30
+
1. In Codex or similar tool shells, bootstrap Shellbrain through a login shell that sources `~/.zprofile`:
2. Assume Shellbrain is already available from a one-time global install. If direct `shellbrain` calls fail in the current session, keep using the `zsh -lc 'source ~/.zprofile >/dev/null 2>&1; ...'` wrapper for Shellbrain invocations before declaring Shellbrain blocked. Only ask the operator to restore the machine-level install if the wrapped check still fails. The operator should also have `SHELLBRAIN_DB_DSN` set and `shellbrain admin migrate` already applied.
32
33
3. Resolve the target repo:
33
34
- Use the current working directory when already inside the repo.
34
35
- Pass `--repo-root /absolute/path/to/repo` when working from somewhere else.
@@ -41,20 +42,22 @@ Treat current repo state as ground truth. Treat Shellbrain as advisory long-term
41
42
`shellbrain read --json '{"query":"What repo constraints or user preferences matter for this task?","kinds":["fact","preference","change"]}'`
42
43
- area-specific facts:
43
44
`shellbrain read --json '{"query":"What facts or changes matter in this subsystem?","kinds":["fact","change","problem","solution"]}'`
44
-
6. Inspect the returned context pack:
45
+
6. When running from Codex, wrap the actual Shellbrain invocations the same way if needed:
46
+
`zsh -lc "source ~/.zprofile >/dev/null 2>&1; shellbrain read --json '{\"query\":\"Have we seen this failure mode before?\",\"kinds\":[\"problem\",\"solution\",\"failed_tactic\"]}'"`
47
+
7. Inspect the returned context pack:
45
48
-`direct` = direct matches
46
49
-`explicit_related` = linked memories, including authored associations and problem/fact chains
47
50
-`implicit_related` = semantic neighbors and bounded associative hops
48
-
7. Re-run `read` liberally during the task whenever the search shifts, you hit a new subproblem, or you suspect the right memory will only become relevant mid-journey.
49
-
8. Before `create` or any evidence-bearing `update`, run `shellbrain events --json '{"limit":10}'`.
50
-
9. Reuse returned `data.events[].id` values verbatim as `evidence_refs`.
51
-
10. At session end, normalize the episode into durable memories:
51
+
8. Re-run `read` liberally during the task whenever the search shifts, you hit a new subproblem, or you suspect the right memory will only become relevant mid-journey.
52
+
9. Before `create` or any evidence-bearing `update`, run `shellbrain events --json '{"limit":10}'`.
53
+
10. Reuse returned `data.events[].id` values verbatim as `evidence_refs`.
54
+
11. At session end, normalize the episode into durable memories:
52
55
- store the `problem`
53
56
- store each `failed_tactic`
54
57
- store the `solution`
55
58
- store any durable `fact`, `preference`, or `change`
56
59
- record `utility_vote` updates for memories that helped or misled
57
-
11. Use the exact payload shapes in [references/request-shapes.md](references/request-shapes.md).
60
+
12. Use the exact payload shapes in [references/request-shapes.md](references/request-shapes.md).
-`shellbrain admin migrate` has been run against the target database.
32
38
33
-
Assume Shellbrain comes from a one-time global install. If the CLI is unavailable, stop and ask the operator to restore the machine-level install first. Do not create per-repo installs unless the operator explicitly wants that.
39
+
Assume Shellbrain comes from a one-time global install. If direct calls fail in the current Codex session, keep using the `zsh -lc 'source ~/.zprofile ...'` wrapper for Shellbrain invocations before declaring Shellbrain blocked. Only if the wrapped check fails should you ask the operator to restore the machine-level install. Do not create per-repo installs unless the operator explicitly wants that.
34
40
35
41
## Repo Targeting
36
42
@@ -181,10 +187,10 @@ Important modeling pattern for changed truth:
181
187
## Recovery
182
188
183
189
-`shellbrain: command not found`
184
-
Ask the operator to restore the one-time global Shellbrain install.
190
+
Retry through `zsh -lc 'source ~/.zprofile >/dev/null 2>&1; shellbrain --help'` first. Only if that still fails should you ask the operator to restore the one-time global Shellbrain install.
185
191
186
192
-`SHELLBRAIN_DB_DSN is not set`
187
-
Ask the operator to export the DB DSN from the shell profile, then rerun `shellbrain admin migrate` if the database is fresh.
193
+
Retry through `zsh -lc 'source ~/.zprofile >/dev/null 2>&1; printf "%s\n" "$SHELLBRAIN_DB_DSN"'` first. If it is still unset, ask the operator to export the DB DSN from the shell profile, then rerun `shellbrain admin migrate` if the database is fresh.
188
194
189
195
- No active host session found
190
196
Verify that the user is working in Codex or Claude Code, that transcript files exist, and that `repo_root` matches the repo used in that session.
0 commit comments