@reddb-io/red-skills-memory 2.75.2

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.
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: improve-skills
3
+ description: Generate approval-gated Skill improvement proposals from Memory Skill telemetry. Use when repeated failures suggest a skill should be patched, but direct self-modification would be unsafe.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # memory improve-skills
8
+
9
+ Generate concrete Skill improvement proposals from Skill telemetry evidence.
10
+
11
+ <what-to-do>
12
+
13
+ **Generate approval-gated Skill improvement proposals from telemetry evidence, review each one before applying, and never patch a skill without explicit human approval.**
14
+
15
+ ## 1. Run the proposal surface
16
+
17
+ Prefer JSON when another agent or command will inspect the result:
18
+
19
+ ```bash
20
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" improve skills --json
21
+ ```
22
+
23
+ To write proposal files:
24
+
25
+ ```bash
26
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" improve skills --write-proposal --json
27
+ ```
28
+
29
+ To list and inspect pending proposal files before applying or archiving:
30
+
31
+ ```bash
32
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" improve proposals list --json
33
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" improve proposals show .red/memory/proposals/<proposal>.md --json
34
+ ```
35
+
36
+ To apply a reviewed proposal that contains a structured patch block:
37
+
38
+ ```bash
39
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" improve apply .red/memory/proposals/<proposal>.md --yes --json
40
+ ```
41
+
42
+ To remove a reviewed proposal from the pending queue without deleting history:
43
+
44
+ ```bash
45
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" improve proposals archive .red/memory/proposals/<proposal>.md --reason rejected --yes --json
46
+ ```
47
+
48
+ The command writes proposals under:
49
+
50
+ ```text
51
+ .red/memory/proposals/
52
+ ```
53
+
54
+ ## 2. Interpret states
55
+
56
+ See [init-chain state taxonomy](../../references/PRECONDITIONS.md#init-chain-state-taxonomy) — for `uninitialized`, run `/memory:init`; for `no-op`, re-run with `--mode graph`; for `unavailable`, add `--skill-telemetry`.
57
+ - `no-candidates` — telemetry does not currently support a proposal.
58
+ - `proposal-ready` — dry-run found proposal candidates but wrote no files. JSON summaries include `recentFailures`, `dominantErrorStage`, `dominantErrorClass`, `patchDrafted`, `score`, `priority`, and `scoreReasons` for machine-readable routing.
59
+ - `proposal-written` — proposal files were written or refreshed for review, including recent failure evidence, a deterministic `Fingerprint`, and a draft structured patch block when the skill file has a safe unique insertion anchor.
60
+ - `applied` — an explicitly approved structured patch was applied.
61
+ - `pending` — proposal lifecycle listing found pending proposal files.
62
+ - `shown` — a specific proposal file was returned for review.
63
+ - `archived` — a proposal was moved under `.red/memory/proposals/archive/<reason>/`.
64
+
65
+ ## 3. Review before applying
66
+
67
+ For each proposal, inspect:
68
+
69
+ - evidence category and reason;
70
+ - target skill path;
71
+ - hypothesis;
72
+ - proposed patch targets;
73
+ - validation plan.
74
+
75
+ Only patch the skill after explicit human approval or an equivalent review gate.
76
+
77
+ `memory improve apply` refuses to run unless all of these are true:
78
+
79
+ - the command includes `--yes`;
80
+ - the proposal contains a fenced ````json memory-skill-patch` block;
81
+ - the proposal file and patch target remain inside `--root`;
82
+ - `oldString` appears exactly once in the target file.
83
+
84
+ Patch block format:
85
+
86
+ ````markdown
87
+ ```json memory-skill-patch
88
+ {
89
+ "path": "plugins/dev/skills/example/SKILL.md",
90
+ "oldString": "text to replace",
91
+ "newString": "replacement text"
92
+ }
93
+ ```
94
+ ````
95
+
96
+ ## 4. Preserve the safety boundary
97
+
98
+ - ✅ Write proposals when telemetry shows repeated failure evidence.
99
+ - ✅ Treat proposal files as review artifacts, not source of truth.
100
+ - ✅ Use `memory improve proposals list/show/archive` to keep the pending queue clean and auditable.
101
+ - ✅ Expect repeated runs to reuse a pending proposal with the same fingerprint instead of creating duplicates.
102
+ - ✅ Review the generated `oldString`: it should target `Setup`/`Prerequisites` for setup failures, `Execution`/`Commands` for execute failures, `Verification`/`Validation` for verify failures, and `Troubleshooting`/`Common Pitfalls` for timeout/lock/rate-limit style failures when those sections exist.
103
+ - ✅ Apply the smallest skill patch that addresses the observed failure mode.
104
+ - ✅ Run repo metadata/skill validation after applying a proposal.
105
+ - ✅ Include recent failed result evidence in proposals so reviewers see the stage/class/code that triggered the recommendation.
106
+ - ✅ Rank proposal candidates by deterministic priority score so agents fix the highest-impact failure loops first.
107
+ - ✅ Generate a draft `json memory-skill-patch` block only when the target skill is readable and has a safe unique anchor.
108
+ - ✅ Require `--yes` and an exact `oldString` match before applying a proposal.
109
+ - ❌ Do not let Memory patch anything unless the proposal has a structured apply block.
110
+ - ❌ Do not let Memory archive proposals without `--yes` and an explicit `--reason applied|rejected|stale`.
111
+ - ❌ Do not let Memory archive, delete, or rewrite Skill files outside the reviewed patch target.
112
+ - ❌ Do not generate proposals from one-off failures without enough evidence.
113
+ - ❌ Do not store secrets or raw transcript dumps in proposals.
114
+
115
+ </what-to-do>
116
+
117
+ <supporting-info>
118
+
119
+ `memory improve skills` currently proposes fixes for curatable skills flagged as `frequently-failing` by partitioned Skill telemetry rollups. Each Evidence card gets a deterministic fingerprint from its telemetry source, refinement route, dominant error pattern, and telemetry window; unresolved cards in `captured`, `routed`, or `proposed` status with the same fingerprint are refreshed in place, while reviewed or terminal cards (`approved`, `rejected`, `promoted`, `archived`) are preserved and a later run creates a new card. Draft patch blocks choose a semantic section anchor from the dominant failure stage/class before falling back to a tail anchor. It is deliberately proposal-gated: the Memory plugin may write `.red/memory/proposals/*.md`, but applying a patch remains an explicit review step handled outside this command.
120
+
121
+ This is the first mutating stage in the self-improvement loop. Proposal generation mutates only `.red/memory/proposals/`; proposal application can patch a target skill only when a reviewed structured block plus `--yes` are both present.
122
+
123
+ </supporting-info>
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: ingest
3
+ description: Walk a repo (or a subtree) and populate the memory graph from its code and markdown — symbols, files, headings, concepts, and the edges between them. Use when the user says "index this repo", "ingest the codebase into memory", "/memory:ingest …", or when you want recall to know about the project's structure before working in it. Requires `memory init --mode graph` to have run.
4
+ ---
5
+
6
+ # memory ingest
7
+
8
+ Indexes a project tree into the **graph** store with the deterministic
9
+ extractors — no LLM calls. Code files (`.ts/.tsx/.js/.jsx/.py/.go/.rs`) become
10
+ `file` + `symbol` nodes with `DEFINED_IN` edges; TypeScript/JavaScript files
11
+ also become `import` nodes with `IMPORTS` edges for static import and re-export
12
+ specifiers. Markdown files become `concept` nodes (one per file, one per h1–h3
13
+ heading) with `REFERENCES` edges for every `[[wiki-link]]`, plus a stored doc
14
+ chunk for later search. Everything dedupes by content hash, so re-ingesting an
15
+ unchanged tree is a no-op.
16
+
17
+ For changed-file freshness, use `memory refresh`: it stores a per-file content
18
+ hash manifest, skips unchanged files, reports added / updated / skipped / stale
19
+ graph elements, and supports hook-friendly `--staged` and `--stdin` modes. The
20
+ first freshness implementation is hook-only; there is no filesystem watcher.
21
+
22
+ This is the `EXTRACTED` (deterministic) ingest path only. Conversation/git
23
+ (`INFERRED`) ingestion is not part of this surface.
24
+
25
+ <what-to-do>
26
+
27
+ **Index the repository tree into the graph store with the deterministic extractors, then relay the file, node, edge, and doc counts so the user knows what was graphed.**
28
+
29
+ ## 1. Require graph mode
30
+
31
+ See [Memory preconditions](../../references/PRECONDITIONS.md). If memory is not initialized, run `/memory:init`. If `mode` is not `graph`, ingest has nothing to write to; tell the user to re-run `memory init --mode graph`.
32
+
33
+ ## 2. Ingest
34
+
35
+ ```bash
36
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" ingest <path>
37
+ ```
38
+
39
+ `<path>` is the directory to walk (defaults to `.`). Add `--max-files N` to cap
40
+ the pass on a large monorepo. `node_modules/`, `dist/`, `.git/`, `.red/`, and
41
+ build/coverage output are ignored by default.
42
+
43
+ ## 3. Scope a Large Repo
44
+
45
+ Before graphing a big tree, scope the pass. The CLI always prints the
46
+ **candidate-file count** before processing so you know what you're about to
47
+ index. Narrow it with `--scope`:
48
+
49
+ ```bash
50
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" ingest <path> --scope core
51
+ ```
52
+
53
+ | `--scope` | What it graphs |
54
+ | ----------------- | -------------------------------------------------------------------- |
55
+ | `proceed` | every candidate (the default) |
56
+ | `core` | core/app source only — skips tests, examples, vendored & lib trees |
57
+ | `libs` | shared library/package code only — skips app trees, tests & examples |
58
+ | `generate-ignore` | writes a committed `.memoryignore` and stops (no ingest this run) |
59
+
60
+ `--scope generate-ignore` writes a **`.memoryignore`** at the repo root — a
61
+ committed, human-editable, gitignore-style list of fast-glob patterns (one per
62
+ line, `#` comments allowed). Commit it so the whole team shares the same graph
63
+ scope. Every later `memory ingest` / `memory refresh` honours it automatically,
64
+ with no re-prompt. Hand-edit it any time to add or remove patterns.
65
+
66
+ ## 4. Refresh Changed Files
67
+
68
+ ```bash
69
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" refresh <file...> --root .
70
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" refresh --staged --root .
71
+ git diff --cached --name-only -z | node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" refresh --stdin --root .
72
+ ```
73
+
74
+ Use `refresh` after small edits or from git hooks. It is graph-mode only and
75
+ does not require a daemon.
76
+
77
+ ## 5. Report
78
+
79
+ The CLI prints the file / node / edge / doc counts. Relay them so the user knows
80
+ what was indexed. For refresh, also relay added / updated / skipped / stale
81
+ graph element counts. Then use `/memory:recall` to read the graph back.
82
+
83
+ ## DOs / DON'Ts
84
+
85
+ - ✅ Ingest after `memory init --mode graph` so recall has structure to search.
86
+ - ✅ Re-run ingest after large refactors — dedupe makes it cheap and keeps the graph current.
87
+ - ✅ Use `memory refresh --staged` or `--stdin` from git hooks for daemon-free freshness.
88
+ - ❌ Don't run ingest in markdown-only mode — there is no graph to populate.
89
+ - ❌ Don't expect call/type graphs yet — this slice extracts symbols, TS/JS imports, and markdown structure only.
90
+
91
+ </what-to-do>
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: init
3
+ description: One-time setup wizard for the memory plugin. Asks what storage to use and writes the per-project memory config. Two modes ship today — markdown-only (plain notes, no engine) and graph (governed operational memory over a per-project RedDB store). Hooks are optional in graph mode; MCP/read surfaces come with graph mode. Use when the user installs the memory plugin and wants to turn memory on, or says "memory init", "set up memory", "initialize memory".
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # memory init
8
+
9
+ <what-to-do>
10
+
11
+ **Bootstrap memory for this repo: pick the storage mode with the user, run the wizard, and confirm which mode and hooks are active before pointing them at the next step.**
12
+
13
+ ## 1. Runtime is fetched automatically (no build step)
14
+
15
+ `${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs` ships with the plugin and resolves
16
+ the runtime on first use — it downloads the bundled CLI (`memory-cli.mjs`) plus
17
+ the native `red` engine into `~/.cache/reddb-memory/<version>/` and verifies
18
+ their checksums (ADR 0029). There is nothing to build or `pnpm install`; the
19
+ first command below just pays a one-time download (needs network). Every command
20
+ in these skills runs through the bootstrap, which delegates to the fetched CLI.
21
+
22
+ ## 2. Run the wizard
23
+
24
+ Run from the repo you want memory in (`--root` defaults to the current dir).
25
+ Pass the mode the user picked:
26
+
27
+ ```bash
28
+ # markdown-only — no engine, nothing auto-fires
29
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" init --mode markdown-only
30
+
31
+ # graph — typed knowledge graph over a per-project RedDB store
32
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" init --mode graph
33
+
34
+ # graph with the four auto-firing hooks on (recall/index/extract/flush)
35
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" init --mode graph --hooks
36
+ ```
37
+
38
+ markdown-only writes a `plugins.memory` block to `.red/config.yaml` (all hooks off, MCP off, RedDB
39
+ not required) and creates `.red/memory/notes/`. graph writes the same config
40
+ shape with `mode: "graph"`, `reddb: true`, a `storePath`, and provisions the
41
+ RedDB store at `.red/memory/graph.rdb`.
42
+
43
+ If graph mode was chosen, read [graph-reference.md](graph-reference.md) for the
44
+ written config shape and how graph writes are stored.
45
+
46
+ Ask the user whether to turn the auto-firing hooks on. Pass `--hooks` only in
47
+ graph mode and only if they say yes; the hooks are wired in the plugin manifest
48
+ but stay **dormant** (the CLI reads the config and exits silently) until the
49
+ config flag is on. On **Codex**, also tell the user to set
50
+ `[features].plugin_hooks = true` in their config — Codex hooks are off by
51
+ default, and note that Codex has no `PreCompact` event (the flush leans on Stop
52
+ + SessionStart there).
53
+
54
+ ## 3. Confirm
55
+
56
+ Tell the user memory is on, which mode, whether the auto-firing hooks are on or
57
+ off, and that they can now use `/memory:store <fact>` and
58
+ `/memory:recall <query>` — which route to the configured mode automatically.
59
+ For graph mode, mention the golden path: store one scoped decision/gotcha,
60
+ recall it, verify with claim-check/readiness/governance, then hand off with a
61
+ context pack when needed.
62
+
63
+ ## DOs / DON'Ts
64
+
65
+ - ✅ Ask before passing `--hooks`; the config flag, not the manifest, is what makes a hook active vs dormant.
66
+ - ❌ Don't require, install, or connect to RedDB in markdown-only mode.
67
+ - ❌ Don't commit `.red/memory/graph.rdb*` — the store is per-project local state, like `node_modules/`.
68
+ - ❌ Don't hand-write the `plugins.memory` block in `.red/config.yaml` — go through the CLI so the schema stays valid.
69
+
70
+ </what-to-do>
71
+
72
+ <supporting-info>
73
+
74
+ ## Storage modes
75
+
76
+ - **markdown-only** — searchable project notes with **zero engine dependency**:
77
+ notes are plain markdown under `.red/memory/notes/`, no hooks fire, no MCP
78
+ server runs, RedDB is not required.
79
+ - **graph** — governed operational memory (nodes + edges) over a per-project
80
+ RedDB store at `.red/memory/graph.rdb`. `/memory:store` writes deduped facts;
81
+ `/memory:recall` returns zero-token governed context with graph expansion,
82
+ provenance/trust, and supersession handling. RedDB is required, but it runs
83
+ out-of-process from the bundled binary — no service to manage. Graph mode can
84
+ also opt into **auto-firing hooks** (SessionStart recall, PostToolUse re-index,
85
+ Stop extract, PreCompact flush where the host supports it); they default off.
86
+
87
+ Hybrid mode is not a separate storage mode: use markdown-only for plain notes or
88
+ graph for governed operational memory. markdown-only never gets hooks. MCP/read
89
+ surfaces are available from the fetched CLI; hook activation still comes from the
90
+ per-project config.
91
+
92
+ ## Plugin dependency
93
+
94
+ The `memory` plugin requires the `dev` plugin (it builds on dev's processes —
95
+ `/afk`, `/triage`, `/diagnose`). Install `dev` first.
96
+
97
+ </supporting-info>
@@ -0,0 +1,40 @@
1
+ # Graph-mode reference
2
+
3
+ Read this only when graph mode was chosen — the config shape written for the
4
+ `plugins.memory` block and how graph writes are stored.
5
+
6
+ ## Config shape
7
+
8
+ markdown-only:
9
+
10
+ ```json
11
+ {
12
+ "version": 1,
13
+ "mode": "markdown-only",
14
+ "notesDir": ".red/memory/notes",
15
+ "hooks": { "sessionStart": false, "postToolUse": false, "stop": false, "preCompact": false },
16
+ "mcp": false,
17
+ "reddb": false
18
+ }
19
+ ```
20
+
21
+ graph:
22
+
23
+ ```json
24
+ {
25
+ "version": 1,
26
+ "mode": "graph",
27
+ "notesDir": ".red/memory/notes",
28
+ "storePath": ".red/memory/graph.rdb",
29
+ "hooks": { "sessionStart": false, "postToolUse": false, "stop": false, "preCompact": false },
30
+ "mcp": false,
31
+ "reddb": true
32
+ }
33
+ ```
34
+
35
+ ## Graph storage internals
36
+
37
+ Graph writes go through RedDB's multi-model DML (`INSERT … NODE/EDGE`), not
38
+ table inserts, and dedupe lives in a KV index — see ADR 0007 for the engine
39
+ constraints. The store is the embedded `file://` RedDB; the SDK spawns the
40
+ bundled `red` binary out-of-process, so there is no service to run.
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: recall
3
+ description: Search the project's configured memory surface and return governed context ranked by relevance. Use when the user asks "what do we know about …", "did we decide …", "have we seen this before", "/memory:recall …", or when you want past decisions/gotchas before acting. Requires `memory init` to have run.
4
+ ---
5
+
6
+ # memory recall
7
+
8
+ Searches the project's memory for facts stored by `/memory:store`, ranked by how
9
+ strongly they match the query — the zero-token read path, no LLM extraction. In
10
+ **markdown-only** mode it full-text-searches the notes; in **graph** mode it runs
11
+ the governed recall engine — deterministic text seeds expanded through the graph
12
+ neighborhood, ranked with tier/trust/recency/centrality, hiding superseded nodes
13
+ behind the current head of a `SUPERSEDED_BY` chain. Vector hits can contribute
14
+ when a vector provider/projection is explicitly ready, but recall is not
15
+ vector-first. Routing follows `memory init`. Graph mode also exposes
16
+ `search`/`neighbors`/`traverse`/`path`/`stats` read verbs, MCP (`memory-mcp`),
17
+ HTTP, context-pack, readiness, claim-check, and Workbench diagnostics; see the
18
+ plugin README.
19
+
20
+ <what-to-do>
21
+
22
+ **Search the memory graph for facts matching the query and fold the ranked hits into your answer — do not re-derive what the project may already know.**
23
+
24
+ ## 1. Require init
25
+
26
+ If memory is not configured — see [Memory preconditions](../../references/PRECONDITIONS.md) — there is nothing to recall; suggest `/memory:init`.
27
+
28
+ ## 2. Recall
29
+
30
+ ```bash
31
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" recall <query terms>
32
+ ```
33
+
34
+ Everything after `recall` is the query. Add `--limit N` to cap results
35
+ (default 10).
36
+
37
+ ## 3. Use the hits
38
+
39
+ Read the returned evidence and fold what's relevant into your answer or your
40
+ next step — cite the fact, don't just dump the list. Treat recall as a governed
41
+ context candidate set: verify stale/high-impact claims before relying on them.
42
+ If there are no matches, say so plainly rather than guessing.
43
+
44
+ ## DOs / DON'Ts
45
+
46
+ - ✅ Recall before re-deriving something the project may already know.
47
+ - ✅ Treat a recalled note as a claim made at store time — verify it still holds before relying on it.
48
+ - ❌ Don't assume an empty result means the fact is false — it may just be unstored.
49
+
50
+ </what-to-do>
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: skills-status
3
+ description: Diagnose Skill telemetry status and recent Skill usage events. Use when checking whether self-improvement telemetry is enabled, whether skills are being observed, or before running the report-only Skill curator. Graph mode with `--skill-telemetry` provides full output; all other states explain what is missing.
4
+ ---
5
+
6
+ # memory skills-status
7
+
8
+ Read-only diagnostic for the self-improvement loop. It shows whether Skill telemetry is uninitialized, unavailable, or enabled; when enabled, it lists observed skills, recent events, and outcome counts.
9
+
10
+ <what-to-do>
11
+
12
+ **Run the skills-status diagnostic, interpret the telemetry state, and recommend the next concrete action — never mutate skills from this command.**
13
+
14
+ ## 1. Run the diagnostic
15
+
16
+ ```bash
17
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" status skills
18
+ ```
19
+
20
+ Use `--all` to include bundled plugin/hub skills, and `--json` when another script needs structured output.
21
+
22
+ ## 2. Interpret the state
23
+
24
+ See the [init-chain state taxonomy](../../references/PRECONDITIONS.md#init-chain-state-taxonomy). For the `uninitialized` case, recommend `memory init --mode graph --skill-telemetry`; for `no-op`, graph mode is required; for `unavailable`, the explicit `skillTelemetry` opt-in is off.
25
+ - `enabled` — read partitioned rollups and recent events; rollups are stored per skill/event marker so telemetry scales beyond the engine KV value cap.
26
+
27
+ Do not treat non-enabled states as errors; this command is a diagnostic and exits cleanly.
28
+
29
+ ## 3. Decide the next action
30
+
31
+ - If telemetry is enabled and the user wants maintenance recommendations, run:
32
+
33
+ ```bash
34
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" curate skills
35
+ ```
36
+
37
+ - If there are archive candidates and the user wants to act, use the `dev` plugin's `/curate` workflow. The Memory plugin's curator is report-only.
38
+ - If events are empty, tell the user telemetry is enabled but no skill use has been observed yet.
39
+
40
+ ## DOs / DON'Ts
41
+
42
+ - ✅ Run before `/curate` so you know whether telemetry is collecting evidence.
43
+ - ✅ Keep default output focused on Curatable skills; use `--all` for bundled read-only skills.
44
+ - ❌ Do not mutate skills from this command.
45
+ - ❌ Do not infer skill quality from one failure; use curator thresholds and human review.
46
+
47
+ </what-to-do>
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: store
3
+ description: Save one durable work fact to the project's configured memory surface. Use when the user says "remember this", "store that …", "/memory:store …", or when you want a scoped decision, gotcha, validation, or why-note to survive across sessions. Requires `memory init` to have run.
4
+ ---
5
+
6
+ # memory store
7
+
8
+ Saves one fact to the project's memory and routes to whatever `memory init`
9
+ configured. In **markdown-only** mode it writes a markdown note under
10
+ `.red/memory/notes/` — the note **is** the canonical store, human-readable and
11
+ committable. In **graph** mode it writes a deduped node to the RedDB store
12
+ (storing the same fact twice returns the same node) with the
13
+ metadata needed for governed recall, freshness, and later supersession. Either
14
+ way the fact is recallable later with `/memory:recall`.
15
+
16
+ <what-to-do>
17
+
18
+ **Save one fact to the project memory — a decision, a gotcha, or a why-note — and confirm the stored identity so the user knows what was captured.**
19
+
20
+ ## 1. Require init
21
+
22
+ If memory is not configured — see [Memory preconditions](../../references/PRECONDITIONS.md) — run `/memory:init` before storing.
23
+
24
+ ## 2. Store the fact
25
+
26
+ ```bash
27
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/bootstrap.mjs" store <the fact text>
28
+ ```
29
+
30
+ Pass the fact as the argument (everything after `store` is joined into one
31
+ note). The CLI routes by config. Markdown-only writes `<timestamp>-<slug>.md` with YAML
32
+ frontmatter and the fact as the body. Graph mode prints the stored/deduped node
33
+ identity and keeps the durable evidence in `.red/memory/graph.rdb`.
34
+
35
+ ## 3. Confirm
36
+
37
+ Report the note path or graph node id so the user knows what was captured.
38
+
39
+ ## DOs / DON'Ts
40
+
41
+ - ✅ Store a single, self-contained fact per call (a decision, a gotcha, a why-note).
42
+ - ✅ Capture the *why*, not just the *what*, when the user is explaining a decision.
43
+ - ❌ Don't store Personal facts (biographical details, identity context, long-lived human preferences) in Memory — see [Brain-vs-Memory boundary](../../../../brain/skills/references/BRAIN_VS_MEMORY.md) and route to `brain capture` instead.
44
+ - ❌ Don't store secrets — notes are plain text on disk and may be committed.
45
+ - ❌ Don't hand-write files into `notesDir` — go through the CLI so ids and frontmatter stay consistent.
46
+
47
+ </what-to-do>
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: view
3
+ description: Open the project Memory graph in red-ui (the visual cluster/query/collections workspace) by pointing the red-ui MCP App at the local RedDB store, falling back to the browser Workbench in terminal hosts. Use when the user wants to SEE the memory graph, clusters, or collections visually rather than recall text.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # memory view
8
+
9
+ Opens the project's Memory graph store (`.red/memory/graph.rdb`) as a visual workspace. The graph data is served by RedDB; this skill only points a renderer at it — it never mutates the store.
10
+
11
+ <what-to-do>
12
+
13
+ **Resolve the store, pick a view, then open it host-aware: the red-ui MCP App in a GUI host, the browser Workbench in a terminal. Read-only — never write to the store, never seed a token in any URL.**
14
+
15
+ ### 1. Resolve the store
16
+
17
+ - Default store path: `.red/memory/graph.rdb` (repo-relative). If `.red/config.yaml` sets `plugins.memory.storePath`, use that instead. Resolve to an absolute path.
18
+ - If the file does not exist, or Memory is in `markdown-only` mode (no graph): tell the user there is no graph to view, point them at `/memory:init` (graph mode) + `/memory:ingest`, and stop. Do not invent a connection.
19
+
20
+ ### 2. Pick the view
21
+
22
+ Map the user's intent to red-ui's view enum (default `cluster` — the graph):
23
+
24
+ - graph / clusters / communities → `cluster`
25
+ - query / search / cypher → `query`
26
+ - collections / tables → `collections`
27
+ - home / overview → `home`
28
+
29
+ ### 3. Open it — host-aware
30
+
31
+ - **GUI / MCP-Apps host** (Claude Desktop, claude.ai, VS Code, Cursor, …): call the red-ui MCP tool **`open_red_ui`** with `{ "connectionUrl": "<abs path to the .rdb store>", "view": "<view>" }`. red-ui spawns a local single-writer `red server` for the file (read-only if the Memory engine already holds it) and renders the workspace embedded in the chat.
32
+ - **Terminal host** (Claude Code), or red-ui unavailable / the app does not render: MCP Apps need an iframe surface a terminal does not have. Fall back to the **Workbench** — run `memory serve` to expose the store over `http://localhost:<port>` and give the user the URL to open in a browser (or `memory workbench` for the static artifact). State clearly that you used the fallback and why.
33
+
34
+ ### Hard rules
35
+
36
+ - ❌ Never write to or mutate the store — this is a read-only viewer.
37
+ - ❌ Never put a secret/token in `connectionUrl` or any iframe URL (red-ui seeds only the non-secret endpoint + route; tokens go over the later postMessage channel).
38
+ - ❌ Do not invent a connection — if the store is absent, stop and route to `/memory:init` / `/memory:ingest`.
39
+ - ✅ Default to `cluster` (the graph) when the user just says "show me the memory graph".
40
+ - ✅ Always name which surface opened (embedded MCP App vs browser Workbench fallback).
41
+
42
+ </what-to-do>
43
+
44
+ <supporting-info>
45
+
46
+ ### Why host-aware
47
+
48
+ MCP Apps (SEP-1865) render a server-provided `ui://` HTML resource inside a sandboxed iframe — only GUI hosts have that surface. The red-ui MCP server (wired into this plugin's `.mcp.json` as `red-ui`) advertises `ui://red-ui/app.html`; the graph data itself is read by the red-ui app **directly from RedDB over HTTP**, not through the MCP bridge — the bridge only passes the connection URL and the view. A terminal host (Claude Code) cannot render the iframe, so the Workbench (`memory serve`) is the equivalent surface there.
49
+
50
+ ### connectionUrl forms
51
+
52
+ - **File path** (e.g. the resolved `.red/memory/graph.rdb`) — red-ui spawns its own `red server` for the file (ADR-0006 single-writer flock; read-only if the Memory engine holds it).
53
+ - **HTTP URL** (e.g. `http://localhost:5055`) — if a `red`/`memory serve` process is already serving the store, pass its URL directly.
54
+
55
+ ### red-ui views
56
+
57
+ `home · query · collections · cluster · security` — `cluster` is the graph/communities visualization.
58
+
59
+ </supporting-info>
@@ -0,0 +1,101 @@
1
+ # C4 Diagram — reference
2
+
3
+ How to build and maintain the wiki's C4 model. The `wiki` skill decides *when* C4 work triggers (the Ingest C4-awareness step and the Lint C4-staleness check own those conditions); this file describes *how* to write it.
4
+
5
+ Optional, complexity-gated. When the system has enough moving parts that one person can't keep the architecture in their head — typically **≥3 services / containers** or any non-trivial cross-system integration — maintain a [C4 model](https://c4model.com) at `.red/wiki/C4.md`. It is the single architectural map for the project; every other wiki page that touches structure references it. The wiki never auto-creates `C4.md` — when a trigger fires and the file is absent, propose creation; once it exists, keep it current.
6
+
7
+ ## Structure
8
+
9
+ The Mermaid block stays minimal (it is just a rendering aid). The **prose around it carries the full C4 content** — actor/system/container/component names, responsibilities, technology choices, relationship semantics.
10
+
11
+ ````markdown
12
+ # C4 — <system name>
13
+
14
+ <one-line description, using the canonical system name from .red/CONTEXT.md>
15
+
16
+ updated: <YYYY-MM-DD>
17
+ context: ../CONTEXT.md _(this file is bound to the glossary — every label below must match)_
18
+
19
+ ## Level 1 — Context
20
+
21
+ ```mermaid
22
+ flowchart LR
23
+ user([User])
24
+ sys[System]
25
+ ext[(External service)]
26
+ user --> sys
27
+ sys -->|HTTPS| ext
28
+ ```
29
+
30
+ **Actors**
31
+
32
+ - **User** _(from CONTEXT.md)_ — <responsibility, what they want from the system>.
33
+
34
+ **Systems**
35
+
36
+ - **System** _(from CONTEXT.md)_ — <purpose, in one sentence>.
37
+ - **External service** _(from CONTEXT.md)_ — <what it provides, why we depend on it>.
38
+
39
+ **Relationships**
40
+
41
+ - User → System: <how they interact, protocol, frequency>.
42
+ - System → External service: <calls made, data exchanged, failure mode>.
43
+
44
+ ## Level 2 — Container
45
+
46
+ ```mermaid
47
+ flowchart LR
48
+ user([User])
49
+ subgraph sys[System]
50
+ api[API]
51
+ db[(Postgres)]
52
+ end
53
+ user -->|HTTPS| api
54
+ api -->|SQL| db
55
+ ```
56
+
57
+ **Containers (inside System)**
58
+
59
+ - **API** _(from CONTEXT.md)_ — <responsibility>. Tech: <language, framework>. Owner: <team / module>.
60
+ - **Postgres** _(from CONTEXT.md)_ — <what it stores>. Tech: <version, hosting>.
61
+
62
+ **Relationships**
63
+
64
+ - User → API: <protocol, auth, payload shape>.
65
+ - API → Postgres: <connection style, transaction discipline>.
66
+
67
+ ## Level 3 — Component _(per container; only where complexity warrants)_
68
+
69
+ ### API _(from CONTEXT.md)_
70
+
71
+ ```mermaid
72
+ flowchart LR
73
+ in([request]) --> handler --> service --> repo[(db)]
74
+ ```
75
+
76
+ **Components**
77
+
78
+ - **Handler** _(from CONTEXT.md)_ — <HTTP-facing layer, validation, auth>.
79
+ - **Service** _(from CONTEXT.md)_ — <domain logic, orchestration>.
80
+ - **Repo** _(from CONTEXT.md)_ — <persistence layer, queries owned>.
81
+
82
+ **Relationships**
83
+
84
+ - Handler → Service: <DTO shape, sync/async>.
85
+ - Service → Repo: <which methods, transactional boundary>.
86
+
87
+ ## Notes
88
+
89
+ - <decisions, assumptions, gaps, "to-be-decided" items — same vocabulary as above>
90
+ - New terms surfaced during diagramming that need a CONTEXT.md entry: <list, or "none">.
91
+ ````
92
+
93
+ The Mermaid syntax is intentionally simple — `flowchart` (universally rendered by every Mermaid viewer including GitHub), not `C4Context` / `C4Container` / `C4Component` (experimental, breaks in many renderers). Shape conventions: `[box]` for system/container/component, `([rounded])` for actor, `[(cylinder)]` for datastore, `subgraph` for "lives inside". The diagram is the index; the prose is the substance.
94
+
95
+ Level 4 (Code) is intentionally omitted — derive it from the source on demand.
96
+
97
+ ## Vocabulary discipline
98
+
99
+ Every name used in the diagram and the prose must match a term already defined in `.red/CONTEXT.md`. If you find yourself writing a name in `C4.md` that is not in the glossary, stop and update the glossary first, then reference it here. The C4 inherits its words from CONTEXT — never the other way around. A term invented inside `C4.md` without a glossary entry is a contradiction the next lint pass will flag.
100
+
101
+ Bump the `updated:` frontmatter on every meaningful edit. The Lint staleness check uses that field to decide whether sources have outpaced the diagram.