@geohar/opencode-cribsheet 0.5.2 → 0.6.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 (2) hide show
  1. package/instructions.txt +133 -29
  2. package/package.json +1 -1
package/instructions.txt CHANGED
@@ -5,32 +5,136 @@
5
5
  (the plugins symlink this file). It directs *approach*; the MCP tool
6
6
  descriptions carry the mechanics. -->
7
7
 
8
- - **Consult memory first.** Before answering about a project, topic, or past decision
9
- — or exploring a codebase cold — `lookup`/`apropos` cribsheet first; the answer may
10
- already be stored, and more current than reasoning from scratch.
11
- - **Prefer the code index over grep/Read for understanding code.** The reflex to
12
- `grep`/`rg`/`Glob` for a symbol — or to open a file to see what it does — is the cue
13
- to reach for the index first; grep is the fallback when it misses, not the default.
14
- - *find code by concept or name* → `code_lookup "…in your own words"`, **not**
15
- `grep -r` (answers by intent + cross-file).
16
- - *understand a symbol + who uses it* → `code_dossier <symbol>`, **not** reading
17
- the whole file (one call: signature, description, callers/callees/references).
18
- - *trace calls* → `code_xref` / `code_graph`, **not** chains of greps.
19
- - *repo not indexed?* → that's the expected first step, not a dead end: **index it**
20
- — `project_index` (indexes the source in one call), then look up. Do NOT read
21
- files or grep instead; there's no shortcut, the utility comes from the index.
22
- - *which project?* → code tools act on ONE **current project**. Set it once for the
23
- codebase you're in (`use_project <name>`, or it's inferred from `project_path` on
24
- your first code call); reads then need no project args. To look up a **different**
25
- project (a related codebase you're referencing), you MUST name it: `project=<name>`
26
- or `project_path=<a path in that repo>`. (`project_path` ≠ your shell cwd — it just
27
- says which repo you mean.)
28
- E.g. not `grep -rn "def boolean"` then reading the file — `code_lookup "boolean path
29
- union/difference"` → `code_dossier` the top hit. (When you finally *get* a tricky
30
- symbol, `code_append <symbol> "…"` pins that understanding for next time.)
31
- - **Persist durably.** When a durable fact emerges (a decision, convention, gotcha,
32
- contract), `store` it — `lookup` first, `append`/`edit` over duplicating. **Name the
33
- project it's ABOUT** (writes require an explicit `project=`/`project_path=` — they
34
- won't inherit your current one): a fact about the repo you're in goes there, but
35
- cross-cutting/tooling knowledge (a CLI, an editor, a shared convention) belongs in
36
- `default` or that tool's own project. Say which project it landed in.
8
+ Five rules. Each fires on a **cue you can catch yourself in the middle of**, not on
9
+ a topic you have to remember to think about. That's deliberate: you will not remember
10
+ to "consult memory" — but you can notice your own hand reaching for `grep`.
11
+
12
+ Rules 4 and 5 are the ones you will walk past most, because their cues don't feel like
13
+ actions: settling a design question and writing a todo list both feel like *thinking*,
14
+ not like *reaching for a tool*. Watch for them anyway.
15
+
16
+ ### 1. About to grep? That's the cue.
17
+
18
+ `grep` / `rg` / `Glob`, or opening a file to see what it does, is a **stop sign, not
19
+ an action**. At that exact moment:
20
+
21
+ | your next move was | do this instead |
22
+ |---|---|
23
+ | grep for a symbol — by name, or by hunch | `code_lookup "what it does, in your own words"` — answers by intent, across files |
24
+ | open the file to understand a symbol | `code_dossier <symbol>` — signature, description, callers, callees, references, in one call |
25
+ | chain greps to trace a caller | `code_xref` / `code_graph` |
26
+ | *(repo isn't indexed)* | `project_index` — one call, and the **expected first step**, not a dead end |
27
+
28
+ grep is the **fallback for when the index misses**. It is never the opening move.
29
+ There is no shortcut around indexing; the utility *is* the index.
30
+
31
+ **Catch yourself:** if you've read three files to answer one question, this rule
32
+ already fired and you walked past it. Stop where you are, `code_lookup`, redo it.
33
+
34
+ ### 2. About to answer from your own knowledge? Look it up first.
35
+
36
+ Cue: you're about to explain a project, a past decision, or a convention — or open a
37
+ codebase cold. `lookup` / `apropos` **before** you answer, not after. What's stored may
38
+ be more current than what you'd reconstruct, and *you can't tell which from the inside*:
39
+ a confident reconstruction feels exactly like a correct one.
40
+
41
+ ### 3. Just understood something? Store it before you move on.
42
+
43
+ Cue: the "ah, *that's* why" moment — a convention, a gotcha, a contract. The
44
+ moment passes; the note has to be written inside it. `lookup` first, then `append`/`edit`
45
+ over creating a near-duplicate.
46
+
47
+ **Not a decision, and not a task.** Those have their own verbs — rules 4 and 5. If what
48
+ you just understood is *why we chose this*, `note_store` is the wrong verb: it takes the
49
+ prose and silently drops the edges, which were the part worth keeping.
50
+
51
+ Writes need an explicit `project=` — they do **not** inherit your current project. Name
52
+ the project the fact is *about*: the repo you're in, or `default` (or that tool's own
53
+ project) for cross-cutting knowledge like a CLI or editor convention. Say where it landed.
54
+ To pin a hard-won insight about a symbol: `code_append <symbol> "…"`.
55
+
56
+ ### 4. Just settled a question — or about to explain why? Use the decision graph.
57
+
58
+ Cue: a design question stopped being open. "Chunks are keyed by X." "Writes must name
59
+ their project." It's the moment the arguing stops — and it feels like you merely
60
+ *finished thinking*, which is exactly why this rule gets walked past.
61
+
62
+ Decisions have their **own verbs**. Use those, not `note_*`: a note holds the prose,
63
+ but only the facet knows what a decision rests on, what rests on it, and what your
64
+ change just invalidated. That last part is the whole point.
65
+
66
+ | your next move was | do this instead |
67
+ |---|---|
68
+ | a question just got settled, and it has consequences | `design_add <title> <rationale>` with `--dep` on what it builds on |
69
+ | the new decision *replaces* an existing one | `design_supersede` — a second `design_add` leaves both standing and both findable |
70
+ | explain *why* it's built this way | `design_lookup "<query>"` **before** reconstructing it from the code — hits flag stale decisions |
71
+ | read / cite a decision | `design_read <ref>` — body **plus** deps, dependents, and whether either moved |
72
+ | change a decision, or code that implements one | `design_check` **first** — then `design_edit`/`design_append`, whose result lists what you just tainted |
73
+ | propose an architecture change | `design_tree` (or `--dependents`) — see what rests on it before you move it |
74
+
75
+ - **Adding is SILENT — so check what it lands next to.** `design_add` seeds its
76
+ `checked` state from its deps as they read right now, so a new decision is
77
+ born verified and nothing gains taint just because it appeared. The graph will
78
+ hold two decisions that flatly contradict each other and never say a word: it
79
+ tracks the edges you declared, not agreement. So `design_lookup` the area
80
+ first, and read the `similar` list the result hands back. Restates an existing
81
+ decision → `design_append`/`design_edit` **that one**. Replaces it →
82
+ `design_supersede`. Changes the ground under other work → `design_check`,
83
+ which is the only verb that answers "what did I just break".
84
+ - **A dep is a promise**: *if that changes, reconsider this.* A plain note can't
85
+ make that promise; the graph can. Every edge checks — there is no "just for
86
+ reference" edge that lets an origin change silently.
87
+ - **Each stale decision** comes back with the chain explaining *why*, what kind of
88
+ change did it, when, and the verb to run. After reconsidering, `design_reaffirm`
89
+ marks it current. Taint means *a dep moved*, not *you were wrong* — reaffirming
90
+ is the cheap, normal ending, so don't treat it as a crisis. When it genuinely no
91
+ longer holds, `design_supersede`.
92
+ - **A hit marked `tainted`** is a decision whose ground shifted and nobody
93
+ re-read. Don't quietly reason from it — `design_read` it first.
94
+
95
+ **Catch yourself:** if you've just written a paragraph explaining why something is
96
+ built the way it is, you either read that out of the graph or you owe it to the
97
+ graph. Same for "let's go with X" — that's a `design_add`, not a sentence.
98
+
99
+ ### 5. About to write a todo list — in a file, in chat, or in your head? That's the cue.
100
+
101
+ `plan_add` instead. An in-chat list dies with the chat and a list in your head dies
102
+ with the context window; a plan item outlives both. One call takes the whole batch,
103
+ and deps can point at earlier items in the same batch.
104
+
105
+ - **`plan_lookup` before you add — it may already be planned.** Another session,
106
+ or another agent, may have written the item you're about to write. An item
107
+ that duplicates a `done` one is louder than a duplicate: either the work
108
+ regressed or you've mis-scoped this, and both are worth knowing *before* a
109
+ second entry exists.
110
+ - **`--dep` the DECISION an item rests on, not just the items before it.** Deps
111
+ mix, and they block differently: a **plan** dep blocks until it's done; a
112
+ **design** dep blocks while it's *tainted*; a **note** dep never blocks. So an
113
+ item that declares the decision it implements drops out of `plan_next` the
114
+ moment that decision's ground moves — the work stops looking actionable
115
+ exactly when it stops being safe to do. That is the plan facet's version of
116
+ "check it didn't break", and it is the only one that fires without you asking.
117
+ - **`plan_status` as you go, not at the end** — `in-progress` is a *claim* other
118
+ agents can see, and marking one `done` tells you what it just unblocked.
119
+ - **`plan_next` is the "where was I" call** — run it when you pick work back up, and
120
+ any future session (yours or another agent's) gets exactly what's actionable now.
121
+
122
+ **Catch yourself:** if you've just typed "first I'll… then I'll…", or reached for a
123
+ scratch todo list, this rule already fired.
124
+
125
+ ### Importing a doc (either facet)
126
+
127
+ Asked to capture a DESIGN.md, a spec, or a plan file? `design_import` / `plan_import`
128
+ that doc, then follow the procedure it returns. They run no model and write nothing —
129
+ they hand you the doc's exact citable sections, what already draws on it, and the
130
+ steps. *You* read and judge. Each entry cites the **section** it came from
131
+ (`--source "DESIGN.md#10.3 Fusion"`, never the whole file), so a later edit to that
132
+ passage re-checks exactly what was drawn from it. Extracted decisions land
133
+ `proposed`: they gate work and taint nothing until a human confirms them with
134
+ `design_promote`.
135
+
136
+ <!-- Project selection for *reads*: code tools act on ONE current project — set it once
137
+ with `use_project <name>`, or it's inferred from `project_path` on your first code
138
+ call; reads then need no project args. To read a *different* project you must name it
139
+ (`project=` / `project_path=`). `project_path` means "which repo I mean" — it is not
140
+ your shell cwd. -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geohar/opencode-cribsheet",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "description": "OpenCode plugin: run the crib (cribsheet) memory + code-index MCP server via sharedserver, register its endpoint, inject the reach-for-crib directive, and ship the /crib command. Stands down when a combiner already serves crib.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",