opencode-thrum-pro 0.1.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 (101) hide show
  1. package/assets/commands/thrum-_deviations-protocol.md +87 -0
  2. package/assets/commands/thrum-_generator-idempotency-protocol.md +15 -0
  3. package/assets/commands/thrum-_project-rules-protocol.md +18 -0
  4. package/assets/commands/thrum-_snapshot-protocol.md +265 -0
  5. package/assets/commands/thrum-_stamp-protocol.md +112 -0
  6. package/assets/commands/thrum-_verify-before-write-protocol.md +27 -0
  7. package/assets/commands/thrum-inbox.md +22 -0
  8. package/assets/commands/thrum-load-context.md +17 -0
  9. package/assets/commands/thrum-overview.md +17 -0
  10. package/assets/commands/thrum-prime.md +30 -0
  11. package/assets/commands/thrum-quickstart.md +14 -0
  12. package/assets/commands/thrum-reply.md +28 -0
  13. package/assets/commands/thrum-restart-extended.md +195 -0
  14. package/assets/commands/thrum-restart.md +293 -0
  15. package/assets/commands/thrum-send.md +31 -0
  16. package/assets/commands/thrum-sleep-extended.md +186 -0
  17. package/assets/commands/thrum-sleep.md +212 -0
  18. package/assets/commands/thrum-team.md +12 -0
  19. package/assets/commands/thrum-update-project.md +259 -0
  20. package/assets/commands/thrum-wait.md +14 -0
  21. package/assets/skills/adversarial-critique/SKILL.md +242 -0
  22. package/assets/skills/brainstorm-queue-aware/SKILL.md +167 -0
  23. package/assets/skills/brainstorm-steward/SKILL.md +181 -0
  24. package/assets/skills/choosing-subagent-models/SKILL.md +244 -0
  25. package/assets/skills/closing-findings-while-warm/SKILL.md +104 -0
  26. package/assets/skills/configure-roles/SKILL.md +229 -0
  27. package/assets/skills/coordinator-assessing-agent-completion/SKILL.md +205 -0
  28. package/assets/skills/coordinator-assessing-agent-completion/scan.py +117 -0
  29. package/assets/skills/coordinator-branch-split-on-block/SKILL.md +168 -0
  30. package/assets/skills/coordinator-context-monitoring/SKILL.md +674 -0
  31. package/assets/skills/coordinator-dispatching-work/SKILL.md +288 -0
  32. package/assets/skills/coordinator-hotpath-merge-gate/SKILL.md +522 -0
  33. package/assets/skills/coordinator-interacting-with-the-owner/SKILL.md +171 -0
  34. package/assets/skills/coordinator-maintaining-memory/SKILL.md +89 -0
  35. package/assets/skills/coordinator-managing-state-and-lifecycle/SKILL.md +192 -0
  36. package/assets/skills/coordinator-merging-code/SKILL.md +331 -0
  37. package/assets/skills/coordinator-philosophy-merge-gate/SKILL.md +442 -0
  38. package/assets/skills/coordinator-plan-reconcile-gate/SKILL.md +198 -0
  39. package/assets/skills/coordinator-post-restart-sweep/SKILL.md +135 -0
  40. package/assets/skills/coordinator-running-autonomous-feature-development/SKILL.md +199 -0
  41. package/assets/skills/coordinator-running-brainstorm-cycles/SKILL.md +654 -0
  42. package/assets/skills/coordinator-running-review-cycles/SKILL.md +153 -0
  43. package/assets/skills/coordinator-single-responsibility-merge-gate/SKILL.md +14 -0
  44. package/assets/skills/diagnosing-fleet-and-daemon/SKILL.md +255 -0
  45. package/assets/skills/efficient-multi-agent-research/SKILL.md +177 -0
  46. package/assets/skills/fixing-documentation-errors/SKILL.md +258 -0
  47. package/assets/skills/implementer-maintaining-memory/SKILL.md +84 -0
  48. package/assets/skills/implementer-orchestrating-execution/SKILL.md +125 -0
  49. package/assets/skills/implementer-receiving-dispatch/SKILL.md +127 -0
  50. package/assets/skills/implementer-receiving-review-feedback/SKILL.md +125 -0
  51. package/assets/skills/implementer-status-and-handoff/SKILL.md +150 -0
  52. package/assets/skills/implementer-tdd-and-quality/SKILL.md +99 -0
  53. package/assets/skills/memory-audit-recover/SKILL.md +153 -0
  54. package/assets/skills/memory-curate/SKILL.md +139 -0
  55. package/assets/skills/memory-maintenance/SKILL.md +87 -0
  56. package/assets/skills/memory-read-discipline/SKILL.md +164 -0
  57. package/assets/skills/memory-search-advanced/SKILL.md +217 -0
  58. package/assets/skills/memory-write-discipline/SKILL.md +135 -0
  59. package/assets/skills/orchestrate/SKILL.md +795 -0
  60. package/assets/skills/persistent-watcher-archetype/SKILL.md +225 -0
  61. package/assets/skills/prime-agent/SKILL.md +92 -0
  62. package/assets/skills/project-hotpath-gate/SKILL.md +255 -0
  63. package/assets/skills/project-philosophy/SKILL.md +418 -0
  64. package/assets/skills/project-philosophy/resources/philosophy-template.md +155 -0
  65. package/assets/skills/project-philosophy/resources/reliability-class-library.md +653 -0
  66. package/assets/skills/project-setup/SKILL.md +1007 -0
  67. package/assets/skills/project-setup/resources/implementation-agent.md +826 -0
  68. package/assets/skills/researcher-answering-queries/SKILL.md +100 -0
  69. package/assets/skills/researcher-investigating/SKILL.md +152 -0
  70. package/assets/skills/researcher-maintaining-memory/SKILL.md +176 -0
  71. package/assets/skills/state-migration/SKILL.md +54 -0
  72. package/assets/skills/thrum/SKILL.md +161 -0
  73. package/assets/skills/thrum/resources/ANTI_PATTERNS.md +132 -0
  74. package/assets/skills/thrum/resources/BOUNDARIES.md +56 -0
  75. package/assets/skills/thrum/resources/CLI_REFERENCE.md +1066 -0
  76. package/assets/skills/thrum/resources/IDENTITY.md +49 -0
  77. package/assets/skills/thrum/resources/LISTENER_PATTERN.md +64 -0
  78. package/assets/skills/thrum/resources/MESSAGING.md +163 -0
  79. package/assets/skills/thrum/resources/TMUX_SESSIONS.md +118 -0
  80. package/assets/skills/thrum/resources/WORKTREES.md +117 -0
  81. package/assets/skills/thrum-memory/SKILL.md +138 -0
  82. package/assets/skills/trace-spec-to-plan/SKILL.md +104 -0
  83. package/assets/skills/trace-spec-to-plan/resources/sweep-agent-prompt.md +57 -0
  84. package/assets/skills/update-queue/SKILL.md +149 -0
  85. package/assets/skills/using-the-queue/SKILL.md +172 -0
  86. package/assets/skills/using-thrum-state/SKILL.md +104 -0
  87. package/assets/skills/verify-against-plan/SKILL.md +323 -0
  88. package/assets/skills/verify-against-source/SKILL.md +237 -0
  89. package/assets/skills/watcher-archetype/SKILL.md +84 -0
  90. package/assets/skills/writing-durable-markdown/SKILL.md +66 -0
  91. package/dist/hooks/block-sync-cd.d.ts +9 -0
  92. package/dist/hooks/block-sync-cd.js +71 -0
  93. package/dist/hooks/block-sync-cd.test.d.ts +1 -0
  94. package/dist/hooks/block-sync-cd.test.js +61 -0
  95. package/dist/hooks/shell-env.d.ts +8 -0
  96. package/dist/hooks/shell-env.js +22 -0
  97. package/dist/index.d.ts +6 -0
  98. package/dist/index.js +25 -0
  99. package/dist/installer.d.ts +2 -0
  100. package/dist/installer.js +86 -0
  101. package/package.json +49 -0
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: memory-maintenance
3
+ description: "Use when an agent needs to update, delete, supersede, or audit an existing memory entry — e.g., after verification, when a finding becomes stale, or when a rule needs amendment. Loads the edit/delete/history protocol + when to retire vs amend."
4
+ ---
5
+
6
+ # Maintaining thrum memory entries
7
+
8
+ This skill carries the canonical lifecycle operations on existing memory entries
9
+ — edit, delete, supersede, history audit.
10
+
11
+ ## Editing an existing entry
12
+
13
+ To update a memory entry's body, title, tags, or zoom levels:
14
+
15
+ ```bash
16
+ cat > /tmp/memory-edit-body.md <<'EOF'
17
+ <updated body>
18
+ EOF
19
+ thrum memory edit <id> --short "@/tmp/memory-edit-body.md"
20
+ thrum memory edit <id> --title "<updated title>"
21
+ thrum memory edit <id> --add-tag <new-tag> # appends (repeatable); --rm-tag removes
22
+ ```
23
+
24
+ Edits create a **history record** — the daemon retains the prior version. View
25
+ edit history:
26
+
27
+ ```bash
28
+ thrum memory history <id>
29
+ ```
30
+
31
+ Each history row shows the field changed, the prior value, and the timestamp.
32
+
33
+ ## When to edit vs supersede
34
+
35
+ | Situation | Action |
36
+ | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
37
+ | Small correction (typo, clarification, tag refinement) | **Edit** — preserves the entry's identity + tracks the change in history |
38
+ | The fact has changed but the topic is still relevant (e.g., updated rule, refined finding) | **Edit** — same topic, evolving content |
39
+ | The entry is superseded by a fundamentally different fact / a redirected understanding | **Supersede** — write a new entry, delete the old, optionally tag the new with `supersedes:<old-id>` |
40
+
41
+ ## Deletion
42
+
43
+ ```bash
44
+ thrum memory delete <id>
45
+ ```
46
+
47
+ Soft-delete by default — the entry is marked deleted but retained in the
48
+ underlying store (recoverable via the daemon's tombstone protocol). To
49
+ hard-purge:
50
+
51
+ ```bash
52
+ thrum memory delete <id> --hard --confirm "DELETE <id>"
53
+ ```
54
+
55
+ `--hard` is irreversible — it issues `memory.purge` instead of `memory.delete`,
56
+ removing the row + tags + edges + FTS shadow and authorizing JSONL compaction on
57
+ next sync. The `--confirm` token must equal `DELETE <id>` exactly; omitting
58
+ `--confirm` falls through to an interactive `Type DELETE <id> to confirm:`
59
+ prompt on stderr, which hangs in non-interactive contexts. Use only when the
60
+ entry contains content that must be physically removed (e.g., credentials
61
+ accidentally captured).
62
+
63
+ ## Staleness review
64
+
65
+ For research notes that carry a `Verified: YYYY-MM-DD @ <commit-sha>` footer,
66
+ periodic staleness review is the researcher's discipline (see
67
+ `researcher-maintaining-memory` skill for the git-diff-based protocol). For
68
+ role-rules, staleness is event-driven: when your behavior is corrected or
69
+ project policy changes, edit the entry to update the `Why:` line.
70
+
71
+ ## Audit trail
72
+
73
+ Every memory entry has a creation timestamp + a `created_by` field tracking the
74
+ authoring agent. Edits append to history; deletions create a tombstone. The
75
+ audit trail is queryable via:
76
+
77
+ ```bash
78
+ thrum memory history <id>
79
+ thrum memory show <id> --format json # includes created_at, created_by, edit_count
80
+ ```
81
+
82
+ ## Refs to other skills
83
+
84
+ - For writing new entries (including supersedes): `memory-write-discipline`
85
+ - For finding entries by ID or topic: `memory-read-discipline`
86
+ - Role-specific maintenance patterns (staleness checks, index file updates):
87
+ invoke your role's `*-maintaining-memory` skill.
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: memory-read-discipline
3
+ description: "Use when an agent needs to find existing memory entries - load role-rules at session start, recall a topic mid-session, or pull the full body of a specific entry. Loads the canonical 3-step zoom-escalation read pattern (scan index, triage short, fetch full on confirm) and covers the list / search / show verbs. For advanced FTS5 plus embedding search options, see also the memory-search-advanced skill."
4
+ ---
5
+
6
+ # Reading thrum memory entries
7
+
8
+ This skill carries the canonical read-command patterns shared by every role.
9
+ Three distinct use cases map to three distinct verbs, all following the same
10
+ **3-step zoom escalation**: scan the index first, triage at short zoom, fetch
11
+ full only when confirmed.
12
+
13
+ ## Canonical Memory Read Flow (3 steps)
14
+
15
+ 1. **SCAN the index** — get onelines for all relevant records:
16
+
17
+ ```
18
+ thrum memory index [--scope <scope>] [--kind <kind>]
19
+ ```
20
+
21
+ or
22
+
23
+ ```
24
+ thrum memory list --zoom oneline [--scope <scope>] [--kind <kind>]
25
+ ```
26
+
27
+ Review titles and onelines. This is cheap — no body content loaded.
28
+
29
+ 2. **TRIAGE with short** — for records that look promising after the scan:
30
+
31
+ ```
32
+ thrum memory show <id> --zoom short
33
+ ```
34
+
35
+ or
36
+
37
+ ```
38
+ thrum memory list --zoom short --kind <kind>
39
+ ```
40
+
41
+ The short body (a paragraph summary) lets you confirm relevance before
42
+ pulling the full content.
43
+
44
+ 3. **FETCH full only when confirmed** — only when the short tier confirms the
45
+ record is what you need:
46
+ ```
47
+ thrum memory show <id> --zoom full
48
+ ```
49
+ or
50
+ ```
51
+ thrum memory show <id>
52
+ ```
53
+ (default zoom = full)
54
+
55
+ **Rule:** Never jump straight to `--zoom full` or `--format body` without first
56
+ scanning and triaging. The index + short tiers exist to save context tokens.
57
+
58
+ ## Use case 1: Session-start enumeration of role-rules
59
+
60
+ To load all role-rules at session start (scope + kind known in advance):
61
+
62
+ ```bash
63
+ # Step 1: scan index
64
+ thrum memory list --zoom oneline --kind agent_rule --scope role
65
+ ```
66
+
67
+ The `--scope role` filter auto-infers your role via daemon identity binding (no
68
+ `:role:<role-name>` qualifier needed). Output shows one record per line with
69
+ `body_oneline` only — scannable.
70
+
71
+ To narrow further by tag (`list` has no tag filter; use `search`):
72
+
73
+ ```bash
74
+ thrum memory search --kind agent_rule --scope role --tag <slug>
75
+ ```
76
+
77
+ If a specific rule looks relevant after the index scan, triage it:
78
+
79
+ ```bash
80
+ thrum memory show <id> --zoom short
81
+ # If still not enough detail:
82
+ thrum memory show <id> --zoom full
83
+ ```
84
+
85
+ ## Use case 2: Topic-driven recall
86
+
87
+ For a topic without a known specific entry, follow all 3 steps:
88
+
89
+ ```bash
90
+ # Step 1: scan
91
+ thrum memory search "<topic keywords>"
92
+
93
+ # Step 2: triage promising hits
94
+ thrum memory show <id> --zoom short
95
+
96
+ # Step 3: fetch confirmed entries
97
+ thrum memory show <id> --zoom full
98
+ ```
99
+
100
+ `search` invokes FTS5 + (when wired) embedding search. Multi-word queries are
101
+ honored. Optional filters:
102
+
103
+ ```bash
104
+ thrum memory search "<topic>" --kind research_note # filter by kind
105
+ thrum memory search "<topic>" --tag <slug> # filter by tag
106
+ thrum memory search "<topic>" --since 30d # filter by recency
107
+ ```
108
+
109
+ Default render: ranked summaries, each showing `body_oneline` only. The deeper
110
+ zoom levels are NOT polluted into search results — triage with `--zoom short`
111
+ before fetching full.
112
+
113
+ ## Use case 3: Pulling the full body of a specific entry
114
+
115
+ When you already know the entry ID (e.g. from a prior search or the index):
116
+
117
+ ```bash
118
+ # Step 2: triage (skip if you already know this is the right entry)
119
+ thrum memory show <id> --zoom short
120
+
121
+ # Step 3: fetch full body
122
+ thrum memory show <id> --zoom full
123
+ # equivalently:
124
+ thrum memory show <id>
125
+ ```
126
+
127
+ Default format (text) renders metadata fields (ID, Kind, Status, Scope, Agent,
128
+ Created, Updated, Tags, Parent) plus all zoom levels present in the entry
129
+ (title, oneline, short, full). To pull just the body:
130
+
131
+ ```bash
132
+ thrum memory show <id> --zoom full # preferred — explicit zoom
133
+ thrum memory show <id> --format json | jq -r '.body_full' # JSON extraction
134
+ ```
135
+
136
+ ## Cross-scope reads
137
+
138
+ Default scope filter (when `--scope` is omitted) returns all scopes the caller
139
+ can access. To explicitly read other roles' rules:
140
+
141
+ ```bash
142
+ thrum memory list --zoom oneline --kind agent_rule --scope role # YOUR role (identity-inferred)
143
+ thrum memory list --zoom oneline --kind agent_rule --scope project # project-wide rules
144
+ thrum memory list --zoom oneline --kind agent_rule # all visible scopes
145
+ ```
146
+
147
+ The CLI does not expose `--scope role:<other-role>` filtering. To inspect
148
+ another role's rules, query the broader scope and grep the result (or narrow
149
+ with `thrum memory search --tag <slug>`).
150
+
151
+ ## Output discipline
152
+
153
+ Default multi-record output (from `list` and `search`) prints `body_oneline`
154
+ only — this is the right zoom level for scanning a result set. Don't pull deeper
155
+ zoom levels for a whole result set; use `show <id> --zoom short` then
156
+ `show <id> --zoom full` for specific entries you need.
157
+
158
+ ## Refs to other skills
159
+
160
+ - For writing new entries: `memory-write-discipline`
161
+ - For deleting / editing / superseding entries: `memory-maintenance`
162
+ - For advanced FTS5 + embedding search options: `memory-search-advanced`
163
+ - Role-specific read patterns (session-start sequences, etc.): invoke your
164
+ role's `*-maintaining-memory` skill.
@@ -0,0 +1,217 @@
1
+ ---
2
+ name: memory-search-advanced
3
+ description: "Use when running thrum memory search with RAG (--near), composing complex predicate stacks, paginating large result sets, interpreting MEM-001..010 hint codes, or diagnosing embedding adapter behavior. Loads three-vector ranking semantics, length-bias caveat, and the full hint catalog."
4
+ allowed-tools: "Bash(thrum memory:*),Bash(thrum config:*)"
5
+ version: "0.11.0"
6
+ license: "Apache-2.0"
7
+ ---
8
+
9
+ # memory-search-advanced — RAG, hint codes, complex predicates
10
+
11
+ Load this sub-skill from `thrum-memory` (umbrella) for predicate needs beyond
12
+ tag + kind + recency filtering.
13
+
14
+ ## Predicate surface (shipped)
15
+
16
+ `thrum memory search` combines all predicates with AND:
17
+
18
+ ```text
19
+ Query:
20
+ positional args — FTS query text; `thrum memory search "<topic>"` is
21
+ equivalent to --grep "<topic>" (multiple args join with single spaces;
22
+ giving both positional and --grep is refused as ambiguous)
23
+
24
+ Identity / structure:
25
+ --kind <kind>, --tag <tag> (SINGLE tag per query), --scope project|agent|role,
26
+ --status <status> ("*" for any; default active)
27
+
28
+ Text:
29
+ --grep <terms> (full-text MATCH over title + body_oneline/short/full;
30
+ terms matched literally — punctuation is not FTS5 operators)
31
+
32
+ Semantic (when embedding adapter enabled):
33
+ --near "<text>"
34
+
35
+ Time:
36
+ --since 7d | <Go duration> | <RFC3339>
37
+
38
+ Sort & limit:
39
+ --sort created_at_desc|updated_at_desc|relevance|pinned_first
40
+ --limit 10 (default)
41
+ --offset N
42
+ ```
43
+
44
+ Output formats: `table` (default), `ids`, `oneline`, `short`, `full`, `json`.
45
+
46
+ Tag-set OR is NOT expressible in one query — `--tag` takes a single tag. For OR
47
+ semantics, run one search per tag and merge.
48
+
49
+ ## DESIGNED — NOT YET SHIPPED (do not use)
50
+
51
+ The original memory-search design specifies a wider predicate surface that the
52
+ shipped CLI does not implement. The flags below DO NOT EXIST today — the CLI
53
+ rejects them with `unknown flag`. They are recorded here as the spec diff for
54
+ the eventual search-surface implementer, NOT as usable commands:
55
+
56
+ ```text
57
+ --id, --kinds (multi-kind), --subkind, --agent / --author, --pinned,
58
+ --tags-any (tag-set OR),
59
+ --since-created, --since-updated, --until,
60
+ --parent <id>, --supersedes <id>, --superseded-by <id>,
61
+ --related-to <id>, --derived-from <id>,
62
+ --grep-field <oneline|short|full|title>, --regex,
63
+ --near-id <id>, --near-limit N
64
+ ```
65
+
66
+ Workarounds with the shipped surface: time filtering = `--since` only (no
67
+ created-vs-updated split); per-field grep = not available (grep spans title +
68
+ all three zooms); edge predicates = not available (edge reads are the
69
+ `memory.listByEdge` RPC, no CLI); `--pinned` = `--tag pinned` (pinned is a
70
+ tag).
71
+
72
+ ## Pagination patterns
73
+
74
+ Default `--limit 10` keeps context bounded. Walk a large set:
75
+
76
+ ```bash
77
+ thrum memory search --kind session_summary --since 30d --limit 25 --offset 0
78
+ thrum memory search --kind session_summary --since 30d --limit 25 --offset 25
79
+ ```
80
+
81
+ For counting: `thrum memory count` is the cheap O(1) counter, but it counts by
82
+ `--agent` / `--role` only — it accepts NO kind/time filters. To count a filtered
83
+ set, read the `total` field from the JSON response (a separate COUNT query,
84
+ computed before LIMIT applies):
85
+
86
+ ```bash
87
+ thrum memory count --role researcher # cheap, coarse
88
+ thrum memory search --kind session_summary --since 30d \
89
+ --limit 1 --format json | jq '.total' # filtered count
90
+ ```
91
+
92
+ Do NOT count via `--limit 0 --format ids | wc -l` — the `--limit 0`
93
+ streaming/export reservation is currently non-functional (the CLI drops
94
+ `limit=0` from the RPC params and the daemon clamps the absent limit to 10, so
95
+ output caps at 10 rows regardless of the real match count).
96
+
97
+ ## RAG semantics (`--near`)
98
+
99
+ `--near "<text>"` runs semantic search against memory embeddings. Three
100
+ per-memory vectors are stored — one per zoom level, embedding the title-prefixed
101
+ string:
102
+
103
+ - `<title> — <body_oneline>`
104
+ - `<title> — <body_short>`
105
+ - `<title> — <body_full>`
106
+
107
+ Ranking is `score = max(sim_oneline, sim_short, sim_full)`. Each result carries
108
+ `matched_zoom` so the CLI can render the zoom level that actually matched.
109
+ Per-zoom embeddings let topical queries dock against `oneline` while
110
+ deep-content queries dock against `full`.
111
+
112
+ ### Length-bias caveat — read before trusting `--near` results
113
+
114
+ Title-prefixed `oneline` strings (~40-50 chars) and `body_full` (up to 256 KB)
115
+ embed in different subspaces of `granite-30m-english`'s 384-dim space. **Short
116
+ queries can systematically match `oneline` over `full` for length-similarity
117
+ reasons rather than semantic-relevance reasons.** This is a real bias inherited
118
+ from the embedding model.
119
+
120
+ Detection and recovery (manual in v1; a future MEM-011+ zoom-divergence
121
+ detector is reserved for this case; the shipped MEM-008 is the
122
+ embed-enqueue-failed warning, not a zoom-divergence detector):
123
+
124
+ - Inspect `matched_zoom` in each result. If short queries return rows dominated
125
+ by `matched_zoom=oneline`, the ranking may have been misled.
126
+ - Re-run with a longer query phrasing.
127
+ - Add `--kind <X>` to narrow before semantic re-rank.
128
+ - Inspect the full body manually, following the shared 3-step read pattern
129
+ (`memory-read-discipline`): triage with `thrum memory show <id> --zoom short`
130
+ first, then fetch with `thrum memory show <id> --zoom full` once confirmed.
131
+
132
+ Mitigations weighed and deferred (don't reach for them yet): weighted
133
+ combination, cross-encoder re-rank, per-kind length normalization. v1 ships
134
+ max-of-three; tune later only if `matched_zoom` diagnostics surface systematic
135
+ problems.
136
+
137
+ ## Hint codes (MEM-001..010)
138
+
139
+ Hints render as a `hints` array in `--json` mode and as inline notices in human
140
+ mode. Suppress everywhere with `THRUM_NO_HINTS=1`. Severity is `warn` for
141
+ blocking-shaped advice, `info` for nudges.
142
+
143
+ | Code | Trigger | What it tells you |
144
+ | --------- | ----------------------------------------------------------------- | -------------------------------------------------------------------- |
145
+ | `MEM-001` | search returned >50 matches | Narrow with `--kind` / `--tag` / `--since` |
146
+ | `MEM-002` | `--near` supplied without `--kind` | Add `--kind` to narrow before semantic re-rank (deferred) |
147
+ | `MEM-003` | empty result with two or more narrowing predicates | Drop the most-restrictive flag |
148
+ | `MEM-004` | `--near` with embedding adapter disabled | Hard refusal — enable the adapter (see setup below) |
149
+ | `MEM-005` | `--grep` matched nothing AND field is empty for most rows of kind | Broaden: drop `--kind` |
150
+ | `MEM-006` | `--near` found rows with `embed_status=pending` → FTS fallback | Wait for backfill or run `memory.embed.rebuild` (deferred) |
151
+ | `MEM-007` | `--near` skipped rows whose `embedding_model` ≠ configured model | Run backfill to migrate vectors (deferred) |
152
+ | `MEM-008` | `memory.create` enqueue to embed worker failed | Best-effort; the worker will retry via `memory.embed.rebuild` |
153
+ | `MEM-009` | `memory.edit` projection detected concurrent edit; LWW loser | Loser's value is preserved in `memory.history` (deferred surfacing) |
154
+ | `MEM-010` | `memory.create` omitted `body_short` or `body_full` | Three-zoom retrieval works better with all three; non-blocking nudge |
155
+
156
+ **Deferred triggers:** MEM-002, MEM-006, MEM-007 are registered today but the
157
+ emission path lights up in a future epic (`--near` adapter wiring +
158
+ multi-model support). MEM-009 emission lights up when LWW-loser surfacing
159
+ lands in the projection response. The codes are stable; only the trigger
160
+ conditions are in flight.
161
+
162
+ **Hard refusal:** MEM-004 is the only hint with `AllowForce=false`. There is no
163
+ recovery flag — the adapter is either present or absent.
164
+
165
+ ## Embedding adapter awareness
166
+
167
+ `--near` only works when the embedding adapter is enabled:
168
+
169
+ ```bash
170
+ thrum config set llm.embedding.enabled true
171
+ thrum config set llm.embedding.provider ollama
172
+ thrum config set llm.embedding.base_url http://localhost:11434
173
+ thrum config set llm.embedding.model "granite-embedding:30m-english"
174
+ ```
175
+
176
+ Embedding work is queued on write (OS-nice `+10`, single-flight per memory_id,
177
+ exponential backoff). Writes never block on embedding. Searches degrade
178
+ gracefully to FTS for not-yet-embedded rows and surface MEM-006 when the
179
+ degradation happens.
180
+
181
+ Edits mark only affected zoom-levels as `embed_status=stale`; tag-only edits
182
+ re-embed nothing, title-only edits re-embed all three. Old vectors stay
183
+ queryable during the staleness window.
184
+
185
+ Cold-start backfill runs once on the first daemon boot with the adapter enabled.
186
+ Disable with `embedding.backfill_on_boot: false`; rate-limit via
187
+ `embedding.max_per_minute` (default 60).
188
+
189
+ ## Composing complex predicates
190
+
191
+ Stack predicates left-to-right; they AND. Use `--scope` only when you
192
+ specifically want to filter by assembly scope (it is NOT visibility — see
193
+ umbrella skill).
194
+
195
+ Example: every active arch decision tagged `substrate`, edited recently,
196
+ semantically related to "RPC routing" (tag-set OR = one query per tag):
197
+
198
+ ```bash
199
+ thrum memory search \
200
+ --kind arch_decision \
201
+ --tag substrate \
202
+ --status active \
203
+ --since 14d \
204
+ --near "RPC routing" \
205
+ --limit 25
206
+ ```
207
+
208
+ Example: every superseded session summary that touched a given epic, paged:
209
+
210
+ ```bash
211
+ thrum memory search \
212
+ --kind session_summary \
213
+ --status superseded \
214
+ --tag epic-thrum-abc \
215
+ --sort updated_at_desc \
216
+ --limit 50 --offset 0
217
+ ```
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: memory-write-discipline
3
+ description: "Use when an agent needs to capture a new memory entry — a rule, a research finding, an observation. Loads the canonical write-command shape, body conventions, title prose convention, tags-as-slug pattern, and scope semantics. Common across all roles that write memory."
4
+ ---
5
+
6
+ # Writing thrum memory entries
7
+
8
+ This skill carries the canonical write-command shape + content discipline shared
9
+ by every role that writes memory. Per-role skills
10
+ (researcher/coordinator/implementer-maintaining-memory) reference this skill for
11
+ the write-command basics and add role-specific guidance (when to write,
12
+ role-specific kinds, etc.).
13
+
14
+ ## Canonical write command
15
+
16
+ ```bash
17
+ cat > /tmp/memory-body.md <<'EOF'
18
+ <body — rule + Why + How to apply, or finding + cites>
19
+ EOF
20
+ thrum memory create --kind <K> --scope <S> \
21
+ --title "<short prose title — what this entry says>" \
22
+ --oneline "<one-line summary, ≤280 bytes>" \
23
+ --short "@/tmp/memory-body.md" \
24
+ --tag <slug-or-keyword> [--tag <additional-tag>]
25
+ ```
26
+
27
+ `--short`/`--full` carry real prose — compose via heredoc or file, never
28
+ double-quoted inline; see the role preamble's 🔴 PROSE INTO A COMMAND rule.
29
+
30
+ Three flags are **REQUIRED** (schema NOT NULL): `--kind`, `--title`,
31
+ `--oneline`. The daemon rejects any `memory.create` call missing these.
32
+ `--short` and `--full` are optional but strongly encouraged — omitting both
33
+ surfaces the MEM-010 hint ("created without all three zoom levels") and degrades
34
+ future retrieval.
35
+
36
+ ## Body shape conventions
37
+
38
+ **For role-rules (`--kind agent_rule`):**
39
+
40
+ ```text
41
+ <rule statement — one sentence>
42
+
43
+ Why: <reason — past incident, project policy, or strong preference>
44
+ How to apply: <when/where this kicks in>
45
+ ```
46
+
47
+ Lead with the rule itself; the `Why:` line is what future-you needs to judge
48
+ edge cases the rule doesn't literally cover. This shape matches the previous
49
+ bd-remember convention by design.
50
+
51
+ **For research notes (`--kind research_note`):**
52
+
53
+ ```text
54
+ <finding statement>
55
+
56
+ Evidence: <file:line citations or external links>
57
+ Verified: YYYY-MM-DD @ <commit-sha>
58
+ ```
59
+
60
+ The Verified-stamp footer enables staleness checks via git diff (see
61
+ `researcher-maintaining-memory` skill).
62
+
63
+ **For other kinds (`arch_decision`, `project_note`, `epic_status`, etc.):**
64
+ Free-form body matching the kind's semantic. Lead with the decision/observation
65
+ itself, then context.
66
+
67
+ ## Title shape
68
+
69
+ **Free-form prose**, ~80 character soft limit. The title appears in every
70
+ `thrum memory list` output, so optimize for human scanability:
71
+
72
+ - GOOD: `"Coordinator must verify implementer findings before forwarding"`
73
+ - GOOD: `"safecmd.Bd 2-return signature mirrors safecmd.Tmux"`
74
+ - GOOD: `"thrum-bot Telegram group monitored by the operator"`
75
+ - AVOID slug-style or role-prefixed: `"coord-verify-findings"` — slug belongs in
76
+ `--tag`, not title.
77
+
78
+ ## Tags as the slug-style handle
79
+
80
+ Per-entry slug (kebab-case keywords describing the topic) lives in `--tag`, not
81
+ the title. This preserves the bd-key-suffix convention as a grep/filter handle:
82
+
83
+ ```bash
84
+ thrum memory create --kind agent_rule --scope role \
85
+ --title "Implementer must use safecmd.Bd not raw exec for bd calls" \
86
+ --oneline "Daemon-adjacent bd invocations must use safecmd.Bd helper" \
87
+ --short "..." \
88
+ --tag safecmd-bd --tag daemon-discipline
89
+ ```
90
+
91
+ Multiple tags are valid — repeat `--tag` per tag. The slug-as-tag pattern lets
92
+ `thrum memory search --tag safecmd-bd` find the entry by its conceptual key.
93
+
94
+ ## Scope semantics
95
+
96
+ `--scope` accepts three values: `project | agent | role`. The CLI auto-infers
97
+ identity from the caller's daemon binding — there is NO `:role:<role-name>`
98
+ shape.
99
+
100
+ | Scope | Use for | Visibility |
101
+ | --------- | ------------------------------------------------- | ----------------------------------------------------------------------- |
102
+ | `role` | Role-rules, role-specific guidance | All agents sharing this role; preferred default for `agent_rule` writes |
103
+ | `agent` | Private rules / notes for this agent instance | Only this agent (by agent_id) |
104
+ | `project` | Shared knowledge across all agents in the project | Every agent in the project |
105
+
106
+ For role-rules, **always use `--scope role`**. The daemon's identity binding
107
+ ensures the entry is scoped to the caller's role automatically; no further
108
+ qualifier needed.
109
+
110
+ ## Zoom-level discipline (oneline / short / full)
111
+
112
+ Per the v0.11 substrate design, memory entries support three body zoom levels:
113
+
114
+ | Field | Length budget | Purpose |
115
+ | -------------- | ------------- | ------------------------------------------------------------- |
116
+ | `body_oneline` | ≤280 bytes | Default search/list render — must convey the gist in one line |
117
+ | `body_short` | ≤4 KB | Mid-zoom — default `show <id>` render |
118
+ | `body_full` | ≤256 KB | Deep zoom — full body via `show <id> --format body` |
119
+
120
+ Populate all three when authoring. Skipping `body_short` and `body_full`
121
+ triggers MEM-010 ("created without all three zoom levels") and degrades
122
+ retrieval quality — search ranks by all three fields, and shallow entries are
123
+ less discoverable.
124
+
125
+ For role-rules, the typical shape: `oneline` = the rule one-liner, `short` =
126
+ rule + Why + How-to-apply, `full` = `short` if no longer body needed (or omit
127
+ `full`).
128
+
129
+ ## Refs to other skills
130
+
131
+ - For loading + querying memory: `memory-read-discipline`
132
+ - For deleting / editing / superseding: `memory-maintenance`
133
+ - Role-specific write triggers + extensions: invoke
134
+ `researcher-maintaining-memory`, `coordinator-maintaining-memory`, or
135
+ `implementer-maintaining-memory` based on your role.