@prismer/runtime 2.0.8 → 2.2.55
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.
- package/CHANGELOG.md +3430 -0
- package/README.md +34 -12
- package/apc/skills/FIELD-DICTIONARY.md +111 -0
- package/apc/skills/bug-reproduce/SKILL.md +150 -0
- package/apc/skills/bug-reproduce/skill.json +96 -0
- package/apc/skills/code-review/SKILL.md +198 -0
- package/apc/skills/code-review/skill.json +124 -0
- package/apc/skills/design-review/SKILL.md +122 -0
- package/apc/skills/design-review/skill.json +88 -0
- package/apc/skills/doc-sync/SKILL.md +168 -0
- package/apc/skills/doc-sync/skill.json +81 -0
- package/apc/skills/env-doctor/SKILL.md +194 -0
- package/apc/skills/env-doctor/skill.json +209 -0
- package/apc/skills/git-ops/SKILL.md +189 -0
- package/apc/skills/git-ops/skill.json +94 -0
- package/apc/skills/impact-trace/SKILL.md +168 -0
- package/apc/skills/impact-trace/skill.json +104 -0
- package/apc/skills/observability/SKILL.md +195 -0
- package/apc/skills/observability/skill.json +116 -0
- package/apc/skills/release-db-config-sync/SKILL.md +186 -0
- package/apc/skills/release-db-config-sync/skill.json +109 -0
- package/apc/skills/release-ota-promote/SKILL.md +195 -0
- package/apc/skills/release-ota-promote/skill.json +176 -0
- package/apc/skills/release-preflight/SKILL.md +174 -0
- package/apc/skills/release-preflight/skill.json +175 -0
- package/apc/skills/release-rollback/SKILL.md +214 -0
- package/apc/skills/release-rollback/skill.json +230 -0
- package/apc/skills/release-tag/SKILL.md +194 -0
- package/apc/skills/release-tag/skill.json +94 -0
- package/apc/skills/releasing-prod/SKILL.md +49 -0
- package/apc/skills/releasing-test/SKILL.md +135 -0
- package/apc/skills/sdk-release/SKILL.md +200 -0
- package/apc/skills/spec-intake/SKILL.md +169 -0
- package/apc/skills/spec-intake/skill.json +93 -0
- package/apc/skills/test-result-feedback/SKILL.md +239 -0
- package/apc/skills/test-result-feedback/skill.json +193 -0
- package/apc/skills/test-runner/SKILL.md +169 -0
- package/apc/skills/test-runner/skill.json +103 -0
- package/apc/skills/ui-align/SKILL.md +209 -0
- package/apc/skills/ui-align/skill.json +114 -0
- package/apc/skills/ui-canvas/SKILL.md +148 -0
- package/apc/skills/ui-canvas/skill.json +127 -0
- package/built-in-skills/agent-coordination/SKILL.md +59 -37
- package/built-in-skills/agent-meta/SKILL.md +1 -0
- package/built-in-skills/assets/SKILL.md +8 -6
- package/built-in-skills/browser-use/SKILL.md +93 -0
- package/built-in-skills/canvas-design/SKILL.md +1 -0
- package/built-in-skills/claim-agent-ownership/SKILL.md +3 -2
- package/built-in-skills/claude-api/SKILL.md +1 -0
- package/built-in-skills/codebase-design/DEEPENING.md +37 -0
- package/built-in-skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/built-in-skills/codebase-design/LICENSE +21 -0
- package/built-in-skills/codebase-design/SKILL.md +116 -0
- package/built-in-skills/conversation-compaction/SKILL.md +114 -0
- package/built-in-skills/council-creator/SKILL.md +426 -0
- package/built-in-skills/diagnosing-bugs/LICENSE +21 -0
- package/built-in-skills/diagnosing-bugs/SKILL.md +136 -0
- package/built-in-skills/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
- package/built-in-skills/doc-coauthoring/SKILL.md +1 -0
- package/built-in-skills/document-generation/SKILL.md +105 -0
- package/built-in-skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/built-in-skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/built-in-skills/domain-modeling/LICENSE +21 -0
- package/built-in-skills/domain-modeling/SKILL.md +76 -0
- package/built-in-skills/frontend-design/SKILL.md +1 -0
- package/built-in-skills/human-approval/SKILL.md +17 -2
- package/built-in-skills/image-generate/SKILL.md +103 -302
- package/built-in-skills/image-generate/scripts/generate-and-deliver.mjs +289 -0
- package/built-in-skills/ingest/SKILL.md +13 -45
- package/built-in-skills/internal-comms/SKILL.md +1 -0
- package/built-in-skills/liteparse/SKILL.md +130 -110
- package/built-in-skills/mcp-builder/SKILL.md +1 -0
- package/built-in-skills/memory/SKILL.md +420 -55
- package/built-in-skills/memory-dream/SKILL.md +339 -0
- package/built-in-skills/office-artifacts/SKILL.md +17 -4
- package/built-in-skills/okr/SKILL.md +154 -0
- package/built-in-skills/persona/SKILL.md +81 -0
- package/built-in-skills/persona-generator/SKILL.md +296 -0
- package/built-in-skills/pkf-svg/SKILL.md +253 -0
- package/built-in-skills/pkf-writing/SKILL.md +236 -0
- package/built-in-skills/prismer-im-collab/SKILL.md +26 -6
- package/built-in-skills/proactivity/SKILL.md +84 -0
- package/built-in-skills/remotion/SKILL.md +431 -0
- package/built-in-skills/role-builder/SKILL.md +203 -0
- package/built-in-skills/role-builder/scripts/author-role.mjs +334 -0
- package/built-in-skills/role-builder/scripts/ingest-role.mjs +223 -0
- package/built-in-skills/role-builder/scripts/instantiate-and-run.mjs +290 -0
- package/built-in-skills/role-builder/scripts/operation-harness.mjs +267 -0
- package/built-in-skills/skill-authoring/SKILL.md +110 -100
- package/built-in-skills/skill-authoring/skill.json +3 -3
- package/built-in-skills/skill-builder/SKILL.md +171 -0
- package/built-in-skills/skill-builder/scripts/ingest.mjs +265 -0
- package/built-in-skills/skill-creator/SKILL.md +165 -423
- package/built-in-skills/skill-creator/references/external-library-import.md +110 -0
- package/built-in-skills/skill-creator/scripts/import-library.mjs +475 -0
- package/built-in-skills/slack-gif-creator/SKILL.md +20 -0
- package/built-in-skills/tasks/SKILL.md +38 -23
- package/built-in-skills/tdd/LICENSE +21 -0
- package/built-in-skills/tdd/SKILL.md +110 -0
- package/built-in-skills/tdd/mocking.md +59 -0
- package/built-in-skills/tdd/refactoring.md +10 -0
- package/built-in-skills/tdd/tests.md +61 -0
- package/built-in-skills/team/SKILL.md +2 -1
- package/built-in-skills/web-artifacts-builder/SKILL.md +1 -0
- package/built-in-skills/webapp-testing/SKILL.md +1 -0
- package/built-in-skills/wechat-pay/SKILL.md +59 -0
- package/dist/cli.cjs +71872 -19960
- package/dist/cli.js +71803 -19846
- package/dist/index.cjs +72010 -19966
- package/dist/index.d.cts +4258 -712
- package/dist/index.d.ts +4258 -712
- package/dist/index.js +72156 -20118
- package/package.json +37 -6
- package/plugins/memory/prismer/__init__.py +1211 -0
- package/plugins/memory/prismer/plugin.yaml +8 -0
- package/plugins/memory/prismer/tool-schemas.generated.json +249 -0
- package/plugins/tools/prismer-recall/__init__.py +282 -0
- package/plugins/tools/prismer-recall/plugin.yaml +15 -0
- package/built-in-skills/memory-curation/SKILL.md +0 -135
|
@@ -1,65 +1,326 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: memory
|
|
3
|
-
|
|
3
|
+
scope: common
|
|
4
|
+
aliases:
|
|
5
|
+
- memory-curation
|
|
6
|
+
description: Persist and retrieve agent memory across sessions — recall via the three-stage protocol (structure route → semantic search → navigation fallback), read via memory_load, see the wiki structure via memory_browse, write well-placed pages via memory_write (including section-level append/rewrite), maintain via memory_curate. Use whenever the user asks to remember/forget something, when you need to look up past decisions or context, or when episodic state matters beyond the current turn. Primary surface is the NATIVE memory_* tools (a `prismer memory` CLI appendix exists for code agents running in a shell).
|
|
4
7
|
---
|
|
5
8
|
|
|
6
9
|
# Memory
|
|
7
10
|
|
|
8
|
-
Use this skill for **durable episodic memory** — facts, decisions, feedback, and project
|
|
11
|
+
Use this skill for **durable episodic memory** — facts, decisions, feedback, and project
|
|
12
|
+
context that need to survive across sessions. Memory has four canonical types: `user`,
|
|
13
|
+
`feedback`, `project`, `reference`. Pages live at semantic paths and are organized as a
|
|
14
|
+
wiki: an `INDEX.pkf` at the top, **hub** pages per topic, and **leaf** pages under hubs.
|
|
15
|
+
|
|
16
|
+
**Richness is the goal.** A memory page should be complete enough that a future session
|
|
17
|
+
works FROM the page instead of re-reading the raw file or the internet. There is no
|
|
18
|
+
length budget on ordinary pages — the only waste is *repetition* (re-extracting what is
|
|
19
|
+
already distilled, re-querying pages already in your context).
|
|
20
|
+
|
|
21
|
+
> **Seam — memory content is PKF; the write invariants are embedded below.** The full
|
|
22
|
+
> body syntax (sections, data views, media, math, harness), validation and projection
|
|
23
|
+
> belong to the **`pkf-writing`** skill, but this skill carries the MANDATORY write
|
|
24
|
+
> invariants inline (see *PKF body standard* below) so a write is safe even when
|
|
25
|
+
> `pkf-writing` is not loaded. **This skill decides WHAT to remember, WHERE it goes, and
|
|
26
|
+
> HOW the graph is maintained.**
|
|
27
|
+
|
|
28
|
+
## Recall protocol — three stages, in order
|
|
29
|
+
|
|
30
|
+
Answer a workspace-knowledge question by walking these stages. Stop at the first stage
|
|
31
|
+
that answers it; never skip straight to guessing.
|
|
32
|
+
|
|
33
|
+
**STAGE 1 — STRUCTURE ROUTE (first round is hybrid).** The first round of any recall is
|
|
34
|
+
**hybrid — two calls in the same round**, never one instead of the other:
|
|
35
|
+
|
|
36
|
+
- **Parameterless `memory_browse`** — the root structure surface: `{index,
|
|
37
|
+
hubs[{path,title,pageType,snippet,updatedAt}], hubsByRecent[], nearest[]}`. Hub order
|
|
38
|
+
has two views: `hubs[]` is the **structural order** (the order the workspace
|
|
39
|
+
publishes; today hub rows are ordered by the hub's own `updatedAt` DESC — that IS the
|
|
40
|
+
structural-order baseline); within a hub, its children come `updatedAt` DESC. Each hub
|
|
41
|
+
row carries **subtree freshness** — `updatedAt` = the most recent write under that hub
|
|
42
|
+
(the hub row's own `updatedAt` spread with its direct children's). `hubsByRecent[]`
|
|
43
|
+
repeats the **same hub set in recency order** (subtree `updatedAt` DESC) — the "what
|
|
44
|
+
changed" signal; the two orders differ exactly when a child page was written more
|
|
45
|
+
recently than its hub row. **There is no `memory_recent` tool** — recency is a signal
|
|
46
|
+
ON browse results, not a query surface. Hubs are *routing* pages: their job is to tell
|
|
47
|
+
you which leaf to open.
|
|
48
|
+
- **Batch `memory_search`** — extract ≥2 phrasings of the turn's terms into `queries[]`
|
|
49
|
+
(≤8, returned grouped in `resultsByQuery`): one round trip, several recall intents.
|
|
50
|
+
When the turn has no lexical terms ("what changed recently?", "what's the team up
|
|
51
|
+
to?"), the batch **degrades but still runs** — the signal query executes anyway.
|
|
52
|
+
|
|
53
|
+
**Both question types are covered in one round.** Term-bearing questions are covered by
|
|
54
|
+
the batch search; termless questions have exactly the structure surface as their search
|
|
55
|
+
space — term extraction necessarily spins empty on them, so the root browse is what
|
|
56
|
+
catches them.
|
|
57
|
+
|
|
58
|
+
**Exemption — one, and tight: the digest names the answer.** The stable memory map
|
|
59
|
+
(INDEX-TOC + one line per hub) injected at turn start under "Memory Map (auto — stable
|
|
60
|
+
digest)" lets you skip the hybrid round ONLY when it **names the answer outright** — the
|
|
61
|
+
exact hub or page the answer lives in, loadable directly. **A passing one-line mention
|
|
62
|
+
is NOT coverage**: if the digest only mentions the hub or topic, the hybrid first round
|
|
63
|
+
still runs. Structural facts the digest itself states (which topics exist, what a hub
|
|
64
|
+
covers, where a topic's children live) are answered from the map, and `memory_browse`
|
|
65
|
+
with the topic as `query` serves follow-up structure questions on demand.
|
|
66
|
+
|
|
67
|
+
**STAGE 2 — SEMANTIC SEARCH (the hybrid round's hits).** The batch `queries[]` leg
|
|
68
|
+
answered the term-bearing side; its hits are your **decision payload** — hop-decision
|
|
69
|
+
fields tell direct-read vs multi-hop, and the browse-root live structure (including its
|
|
70
|
+
recency signals) tells where to wander next. Read each hit's hop-decision fields before
|
|
71
|
+
deciding what to do:
|
|
72
|
+
|
|
73
|
+
| Field | What it tells you |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `tier` | `wiki` = distilled/curated page (highest trust); `asset` = a raw span a distilled page already cites via `derived-from` (middle); `raw` = the upload's own text, no synthesis (lowest — verify before relying on it) |
|
|
76
|
+
| `hubPath` | the hub this page hangs under — a `wiki` hit is context for its whole hub, so a near-miss here often means the ANSWER is a sibling leaf |
|
|
77
|
+
| `childrenCount` | how many pages fan out under this hit (>0 ⇒ it is a hub you can walk down) |
|
|
78
|
+
| `outboundPreview` / `inboundLinkCount` | where the page points / how linked it is — the cheap next hop |
|
|
79
|
+
| `sectionAnchor` + `sectionPreview` | the exact section that matched — read THAT, not the whole page |
|
|
80
|
+
|
|
81
|
+
`memory_search` returns **ranked hits with lexical evidence** (the query matched the
|
|
82
|
+
page). A high-rank `wiki` hit is usually the answer; `memory_load` the page (or just the
|
|
83
|
+
`#section`) when the snippet is not enough.
|
|
84
|
+
|
|
85
|
+
**STAGE 3 — NAVIGATION FALLBACK (miss).** When your wording matched nothing — or only
|
|
86
|
+
grazed unrelated pages — the response carries **`navigation`** instead of a longer hit
|
|
87
|
+
list:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
navigation: { reason: 'text-miss',
|
|
91
|
+
startPoints: [{ path, title, pageType: 'index'|'hub', childrenCount, why: 'structural-entry' }],
|
|
92
|
+
guidance: '…' }
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`startPoints` are **starts, not answers** — there is no rank among them, so never read
|
|
96
|
+
them as scored hits and never quote one as the answer. They are the workspace's routing
|
|
97
|
+
entries (INDEX + hubs, children-rich first). Walk them:
|
|
98
|
+
|
|
99
|
+
1. **Look at the children** of the start point closest to your topic (`memory_browse`
|
|
100
|
+
with the hub as `query`, or `memory_load` the hub — its TOC lists its children).
|
|
101
|
+
2. **Batch-read the candidates**: one `memory_search` with the candidate topics as
|
|
102
|
+
`queries[]`, or `memory_load` each page. Load the section, not the whole page, when
|
|
103
|
+
the TOC gives you an anchor.
|
|
104
|
+
3. **Follow links** (`memory_load` returns the page's `links`) until a page actually
|
|
105
|
+
carries the answer.
|
|
106
|
+
|
|
107
|
+
If the walk finds nothing, the knowledge does not exist yet — say so, and consider
|
|
108
|
+
writing it (see *Write flow*) rather than answering from thin air.
|
|
109
|
+
|
|
110
|
+
## Tool surface (native tools — your primary interface)
|
|
111
|
+
|
|
112
|
+
| Tool | What it does |
|
|
113
|
+
|---|---|
|
|
114
|
+
| `memory_search {query, queries?, limit?, pageType?}` | Semantic/FTS recall + batch; ranked hits with the hop-decision payload, or `navigation` start points on a miss |
|
|
115
|
+
| `memory_load {uri?, path?}` | Read one page (or one section via `#anchor` in the uri) → `{page, content, links}` — `links` are the page's outbound graph edges |
|
|
116
|
+
| `memory_browse {query?}` | **See the structure BEFORE writing** → `{index, hubs[{path,title,pageType,snippet,updatedAt}], hubsByRecent[], nearest[]}` |
|
|
117
|
+
| `memory_write {path, content, title?, parentHubPath?, relation?, op?, section?}` | Create, extend, or section-edit a page; `parentHubPath` attaches it under a hub; `op="append-section"` / `op="rewrite-section"` + `section` edit ONE section (see *Write flow*) |
|
|
118
|
+
| `memory_curate {op, ...}` | Maintenance verbs — see the **memory-dream** skill (write ops are orchestrator-gated) |
|
|
119
|
+
|
|
120
|
+
<!-- GENERATED:tool-params:start -->
|
|
121
|
+
<!-- ⚠️ GENERATED BLOCK — do not hand-edit. -->
|
|
122
|
+
<!-- Regenerate: npx tsx scripts/memory211/generate-memory-tool-contract.ts -->
|
|
123
|
+
|
|
124
|
+
Parameter names below are EXACTLY what the tools accept (trailing `*` = required).
|
|
125
|
+
|
|
126
|
+
- **`memory_search`**: `query*` · `queries[]` · `limit` · `pageType[]`
|
|
127
|
+
- **`memory_load`**: `uri` · `workspaceId` · `path`
|
|
128
|
+
- **`memory_browse`**: `query`
|
|
129
|
+
- **`memory_write`**: `path*` · `content*` · `title` · `parentHubPath` · `relation` (child-of|related) · `op` (replace|append-section|rewrite-section) · `section` · `visibility`
|
|
130
|
+
- **`memory_curate`**: `op*` · `pageId` · `childPaths[]` · `reason` · `kind` · `limit` · `section` · `targetSection` · `sourcePageId` · `sourceSection` · `mergedContent` · `supersededByPageId` · `supersededBySection` · `linkId` · `toPageId` · `toPath` · `toSection`
|
|
131
|
+
|
|
132
|
+
<!-- END GENERATED BLOCK -->
|
|
133
|
+
<!-- GENERATED:tool-params:end -->
|
|
134
|
+
|
|
135
|
+
`web_load` (the workspace URL loader) also accepts `prismer://asset/…` and
|
|
136
|
+
`prismer://…/file/…` URIs — when a memory page points at an asset, load the asset
|
|
137
|
+
on demand through it instead of asking the user to re-attach the file.
|
|
138
|
+
|
|
139
|
+
## PKF carrier → Memory: automatic durable distillation, explicit exact copy
|
|
140
|
+
|
|
141
|
+
**PKF is the content format, not a fourth carrier.** A valid PKF report remains
|
|
142
|
+
authoritative in its message-inline block or Library Asset. For message-inline delivery,
|
|
143
|
+
the Runtime passes the validated PKF source and its Markdown projection into the normal
|
|
144
|
+
post-turn Memory classifier automatically: durable conclusions are distilled through
|
|
145
|
+
the same browse-first placement flow, while transient report content yields no Page.
|
|
146
|
+
Do not ask the user for a second format choice and do not exact-copy the report merely
|
|
147
|
+
because it is PKF. Dream still reads authoritative **Memory Pages only**.
|
|
148
|
+
|
|
149
|
+
- **Distill durable knowledge (normal path):** inline PKF enters the Runtime post-turn
|
|
150
|
+
classifier automatically; explicit Asset handling or user-requested writes extract only
|
|
151
|
+
surviving conclusions through the browse-first `memory_write` flow — typed source
|
|
152
|
+
pointer, never the whole report.
|
|
153
|
+
- **Preserve the exact inline PKF as Memory (exception):** only when the user explicitly
|
|
154
|
+
wants those exact bytes as the Memory authority — `cloud pkf materialize` (message/block
|
|
155
|
+
revision, source hash, explicit `.pkf` path, idempotency key, `--confirm-path`); no
|
|
156
|
+
native `memory_*` shortcut, no generic Asset→Memory exact-copy. Read back the receipt;
|
|
157
|
+
exact-copy is an exceptional authority transition, not the searchability path.
|
|
158
|
+
|
|
159
|
+
Once either route creates/updates a Memory Page, curation operates on that Page's graph,
|
|
160
|
+
revisions and PKF body—not on its former carrier.
|
|
161
|
+
|
|
162
|
+
## Deliverable adoption — copy + reference (memory211 轴A)
|
|
163
|
+
A deliverable YOU produced this turn gets an immediate three-way decision: extend the existing page at section granularity, attach a new leaf under the best hub, or SKIP — skipping is a first-class outcome (a one-off answer is not knowledge). Deliverable-derived pages follow the **copy + reference** doctrine: they may carry the source's near-full content so a future session works FROM the page instead of re-opening the asset, and they MUST carry the typed references — exactly ONE `<a rel="derived-from" href="prismer://asset/<assetId>">` pointer, section-anchored `<a rel>` edges, and the source's own vocabulary (proper nouns, codes/numbers, thresholds verbatim) so a paraphrase of the source is still findable. There is no length budget: token usage is recorded, never constrained. Pass `deliverableSource: {assetId, contentHash, sizeBytes}` on `memory_write` — the gate enforces the pointer (422 `deliverable_pointer_missing`), short-circuits a same-deliverable replay as a dedupe-hit, and routes an oversized source to sharding (422 `sharding_required`) instead of one giant page. `memory_search` an existing topic first and extend/supersede any page whose pointer cites a prior revision, never fork.
|
|
164
|
+
|
|
165
|
+
## Sharding — one page per 64K characters (memory211 §6.9)
|
|
166
|
+
|
|
167
|
+
A **source over 64K characters** never becomes one page, and a distilled **page stays
|
|
168
|
+
under 64K characters**. The write gate rejects an oversized page with
|
|
169
|
+
422 `sharding_required`; the ingest pipeline plans the split for you (one structural
|
|
170
|
+
**index page** above a run of **shard pages**, `shards/<stem>/shard-000.pkf` …, boundaries
|
|
171
|
+
on content edges). The reference chain is mandatory and is what keeps a shard set
|
|
172
|
+
navigable:
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
index page --derived-from--> the source asset
|
|
176
|
+
shard page --child-of------> the index page
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Write one page per shard (same copy + reference rules), then the index page with its
|
|
180
|
+
TOC. Never merge shards back into a single giant page.
|
|
9
181
|
|
|
10
182
|
## When to use
|
|
11
183
|
|
|
12
184
|
- The user explicitly says **"remember X"** or **"forget X"** → write or delete immediately.
|
|
13
|
-
- The user references a past decision, preference, or detail you don't have in current context → recall first.
|
|
14
|
-
- Before answering
|
|
185
|
+
- The user references a past decision, preference, or detail you don't have in current context → recall first (three-stage protocol above).
|
|
186
|
+
- **Before answering anything about workspace knowledge you did not just read, run
|
|
187
|
+
the hybrid first round — batch `memory_search` + parameterless `memory_browse`.**
|
|
188
|
+
Attached files are raw sources — check memory for existing
|
|
189
|
+
distilled knowledge before re-reading them. A memory hit is cheaper and already
|
|
190
|
+
synthesized; fall back to the raw asset only when memory misses (`tier: 'raw'` tells
|
|
191
|
+
you that you are reading the source, not the synthesis).
|
|
15
192
|
- After a non-obvious clarification or correction lands, write it so the next session keeps the lesson.
|
|
193
|
+
- After you read/ingest a document and extract durable conclusions, **persist them as a
|
|
194
|
+
placed page in the same turn** — don't leave the knowledge only in your reply.
|
|
16
195
|
|
|
17
|
-
##
|
|
196
|
+
## Path convention
|
|
18
197
|
|
|
19
|
-
|
|
198
|
+
Paths are workspace-relative and **prefix-free** — do NOT add a leading `memory/`:
|
|
20
199
|
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
--type project \
|
|
26
|
-
--description "We chose PostgreSQL over MySQL; deadline 2026-06-01." \
|
|
27
|
-
--content "## Decision\nPostgres 16 because pgvector + better JSON ops."
|
|
28
|
-
|
|
29
|
-
# Quick fact (no path → auto-named under inbox/)
|
|
30
|
-
cloud memory write --type feedback --content "User prefers terse end-of-turn summaries"
|
|
31
|
-
|
|
32
|
-
# From a journal blob — service extracts structured entries
|
|
33
|
-
cloud memory extract --journal "Long stream-of-consciousness session notes..."
|
|
200
|
+
```
|
|
201
|
+
decisions/llm-provider.pkf ← a leaf under the decisions topic
|
|
202
|
+
projects/desktop-202/decisions.pkf ← nested topic path
|
|
203
|
+
reference/platform.pkf ← a hub page
|
|
34
204
|
```
|
|
35
205
|
|
|
36
|
-
|
|
206
|
+
The platform-owned onboarding seed uses reserved `memory/onboarding/...` paths; that is
|
|
207
|
+
not a pattern for agent-authored pages. Always reuse an existing returned seed path
|
|
208
|
+
verbatim if you extend one.
|
|
37
209
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
cloud memory list --type feedback # by type
|
|
43
|
-
cloud memory list --updated-after "2026-05-01" # by recency
|
|
44
|
-
```
|
|
210
|
+
When extending or linking to an existing page, **use its path exactly as returned by
|
|
211
|
+
`memory_browse` / `memory_search`** — never re-derive or hand-normalize a path you saw
|
|
212
|
+
elsewhere. Path drift (adding/dropping a `memory/` prefix, guessing `.pkf` suffixes) is
|
|
213
|
+
the top cause of dead links and dropped edges.
|
|
45
214
|
|
|
46
|
-
|
|
215
|
+
## Write flow (browse-first)
|
|
47
216
|
|
|
48
|
-
|
|
49
|
-
cloud recall "what database did we choose?" # default: hybrid
|
|
50
|
-
cloud recall "timeout retry" --strategy keyword # exact-match fast path
|
|
51
|
-
cloud recall "the thing with the auth bug" --strategy llm # LLM-assisted; slowest, best for fuzzy
|
|
52
|
-
cloud recall --layer memory --top-k 5 "..." # narrow to one layer
|
|
53
|
-
```
|
|
217
|
+
Writing memory is **browse → decide placement → write → verify**. Never write blind.
|
|
54
218
|
|
|
55
|
-
|
|
219
|
+
**STEP 1 — CONSTRUCT.** Extract the durable knowledge from the conversation and author
|
|
220
|
+
the page body in full (via `pkf-writing`: frontmatter with its one-sentence
|
|
221
|
+
`description` + sections + any rich content). Don't write a path-shaped stub.
|
|
56
222
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
223
|
+
**STEP 2 — BROWSE.** Call `memory_browse` with your topic as the query.
|
|
224
|
+
|
|
225
|
+
**STEP 3 — DECIDE placement** from what browse returned — exactly one of:
|
|
226
|
+
|
|
227
|
+
- **(a) A page on this topic already exists** (in `nearest`) → **you MUST extend it,
|
|
228
|
+
never fork a near-duplicate page.** Decide at *section* granularity:
|
|
229
|
+
- the page has a section whose topic matches your fact → merge into that section
|
|
230
|
+
(`op="rewrite-section"` with that section's id);
|
|
231
|
+
- the page matches but has no section for this fact → add one
|
|
232
|
+
(`op="append-section"` with a new section id).
|
|
233
|
+
- **(b) It fits under an existing hub** (in `hubs`) → write a **new leaf attached to that
|
|
234
|
+
hub**: pass the hub's path as `parentHubPath`.
|
|
235
|
+
- **(c) Genuinely new topic** (no hub fits) → first create the topic **hub page** (type
|
|
236
|
+
`hub`, a short `#overview` "what this topic covers" body), then write the leaf with
|
|
237
|
+
`parentHubPath` pointing at your new hub.
|
|
238
|
+
|
|
239
|
+
**NEVER write an orphan leaf** — a new page with no hub attachment that extends nothing.
|
|
240
|
+
The platform rejects an unanchored new leaf with a `placement_required` error listing
|
|
241
|
+
the available hubs; if you see that error, re-browse and attach — do not retry verbatim.
|
|
242
|
+
|
|
243
|
+
**STEP 4 — WRITE** with the placement declared structurally, and **validate the body via
|
|
244
|
+
`pkf_validate` BEFORE persisting** (authoring loop from `pkf-writing`).
|
|
245
|
+
|
|
246
|
+
`memory_write` is a mutation: a response containing `{"ok":true}` means that revision
|
|
247
|
+
has already been written. For the same fact/path, **do not call `memory_write` again in
|
|
248
|
+
this turn** to polish, reformat, or “make sure”; that creates another authoritative
|
|
249
|
+
revision. Continue to STEP 5 and use the read surface for verification.
|
|
250
|
+
|
|
251
|
+
**STEP 5 — VERIFY (optional but cheap).** Use `memory_load` on the exact returned path
|
|
252
|
+
(or `memory_search` a key phrase) and confirm it comes back. Verification is read-only;
|
|
253
|
+
never rewrite a successful revision merely to verify it. Then report path + placement +
|
|
254
|
+
one-line description to the user.
|
|
255
|
+
|
|
256
|
+
## PKF body standard (embedded — MANDATORY)
|
|
257
|
+
|
|
258
|
+
Full syntax lives in the single-file `pkf-writing` SKILL.md; these four invariants a write must never violate:
|
|
259
|
+
|
|
260
|
+
1. **REQUIRED frontmatter `description` (one sentence)** — in the PKF frontmatter block alongside `type` (`user|feedback|project|reference`), `title`, `pkfVersion "1.1"`; the description feeds previews/TOC — never omit it (frontmatter 写法见 `pkf-writing` skill)。
|
|
261
|
+
2. **Typed links target what actually exists** — copy hrefs VERBATIM from `memory_browse`/`memory_search`/`memory_load` or asset resolver results, never hand-type; `child-of` points FROM child TO hub.
|
|
262
|
+
3. **`pkf_validate` BEFORE `memory_write` — every time** — repair ALL errors, then persist (the write gate rejects invalid v1.1 bodies anyway).
|
|
263
|
+
4. **Browse-first + append governance** (your operating directive's rules) — extend an existing page at section granularity (`op="append-section"`/`op="rewrite-section"`); new pages attach under a hub (`parentHubPath`); never orphan leaves or whole-page-rewrite another agent's page.
|
|
264
|
+
|
|
265
|
+
If a `pkf_validate`-clean body is not achievable, **do not persist it**. Keep the draft in
|
|
266
|
+
the current response/working file, report the validation or capability failure, and
|
|
267
|
+
leave Memory unchanged; never fake a revision or bypass the write gate.
|
|
268
|
+
|
|
269
|
+
## Structural edges — how pages relate
|
|
270
|
+
|
|
271
|
+
Relationships between pages are **graph edges**, not prose. Declare them structurally:
|
|
272
|
+
|
|
273
|
+
- `parentHubPath` on `memory_write` — attaches the written page under a hub. Default
|
|
274
|
+
`relation` is `child-of`; pass `relation="related"` for a non-hierarchical association.
|
|
275
|
+
- `childPaths` on `memory_curate(op="promote_to_hub")` — attaches existing pages under a
|
|
276
|
+
newly promoted hub in one call (orchestrator convergence; see **memory-dream**).
|
|
277
|
+
- In-content typed links (rel vocabulary from `pkf-writing`) **with canonical hrefs
|
|
278
|
+
copied from browse/search/load results** are also materialized into edges — fine for
|
|
279
|
+
`supports` / `contradicts` / `related` / `references` / `cites` cross-refs inside
|
|
280
|
+
prose. For hub attachment, prefer the structural parameters.
|
|
281
|
+
|
|
282
|
+
**Direction matters for `child-of`: the edge points FROM the child TO the hub.**
|
|
283
|
+
`parentHubPath` gets this right automatically (the page you are writing is the child).
|
|
284
|
+
If you ever hand-write a `child-of` content link, it goes **in the child page's body,
|
|
285
|
+
pointing at the hub** — never the reverse. Hubs never declare child-of links.
|
|
286
|
+
|
|
287
|
+
## INDEX & hubs — ownership is asymmetric
|
|
288
|
+
|
|
289
|
+
- **Top `INDEX.pkf`:** its authored semantic sections are agent/editor territory. Its
|
|
290
|
+
visible Contents is derived live from the `child-of` graph; Dream does **not** store
|
|
291
|
+
or rewrite an INDEX `#toc`. Change the graph, not a copied list.
|
|
292
|
+
- **Hub `#overview`:** agent-owned prose—what the topic covers and how children relate.
|
|
293
|
+
- **Hub `#toc`:** machine-owned strict PKF section, regenerated by
|
|
294
|
+
`memory_curate(op="rebuild_index")` from graph membership. Never hand-edit it.
|
|
295
|
+
|
|
296
|
+
Thus `rebuild_index` is a legacy verb name: it rewrites hub TOCs and refreshes derived
|
|
297
|
+
structure, while INDEX Contents remains a read-time projection.
|
|
298
|
+
|
|
299
|
+
## Extending pages (and other agents' pages) — section ops
|
|
300
|
+
|
|
301
|
+
To add knowledge to an existing page, **edit at section granularity — do not rewrite the
|
|
302
|
+
whole page**. Whole-page rewrites of pages another agent authored create version
|
|
303
|
+
conflicts and clobber their content. The section ops splice ONE section cloud-side:
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
memory_write(path="decisions/database-choice.pkf", op="append-section",
|
|
307
|
+
section="revisit-2026-07", content="<section body per pkf-writing>")
|
|
61
308
|
```
|
|
62
309
|
|
|
310
|
+
Default `op` is `replace` (whole page) — reserve it for pages you authored yourself.
|
|
311
|
+
|
|
312
|
+
## Size discipline (a discipline, not a limit)
|
|
313
|
+
|
|
314
|
+
- **INDEX and hubs: keep them lean** — overview prose + TOC, nothing else. Every recall
|
|
315
|
+
hop reads them. Nothing enforces this — when a hub outgrows itself it surfaces as a
|
|
316
|
+
`memory_curate(op="candidates", kind="oversized")` split *suggestion*.
|
|
317
|
+
- **Ordinary pages: no budget, but a hard ceiling at 64K characters** — above that the
|
|
318
|
+
source must be sharded (see *Sharding*), never squeezed. Rich is right: full tables,
|
|
319
|
+
exact numbers, media pointers, rationale prose.
|
|
320
|
+
- **The only token rules are anti-waste:** don't re-extract content that is already
|
|
321
|
+
distilled into a page (extend it instead), and don't re-query pages already in your
|
|
322
|
+
context (circular recall).
|
|
323
|
+
|
|
63
324
|
## Memory Types
|
|
64
325
|
|
|
65
326
|
| Type | What it is | When to write |
|
|
@@ -69,38 +330,142 @@ cloud memory compact <conversation-id> # summarize a long co
|
|
|
69
330
|
| `project` | Goals, deadlines, decisions, ongoing initiatives | When you learn who/what/why/by-when that isn't derivable from code |
|
|
70
331
|
| `reference` | Pointers to external systems (Linear, Slack, dashboards) | When the user names a tool/channel and its purpose |
|
|
71
332
|
|
|
333
|
+
The type goes in the PKF frontmatter `type` field (the four canonical types above, or an
|
|
334
|
+
OKF subtype like `decision`) — the exact frontmatter shape is taught by `pkf-writing`.
|
|
335
|
+
|
|
72
336
|
## Operating Rules
|
|
73
337
|
|
|
74
338
|
### Write
|
|
75
339
|
|
|
76
|
-
- **
|
|
77
|
-
- Don't save
|
|
78
|
-
- Don't save **
|
|
79
|
-
- Don't save
|
|
340
|
+
- **Follow the browse-first flow** above. Never write an orphan leaf, never guess a path.
|
|
341
|
+
- **Don't save secrets, credentials, personal data, or one-off debugging chatter.**
|
|
342
|
+
- Don't save **generic programming advice** that isn't tied to this project.
|
|
343
|
+
- Don't save **ephemeral task state** (in-progress work, current-conversation context).
|
|
344
|
+
- Don't save things derivable from the **current project state** (file paths,
|
|
345
|
+
conventions, git history). Reading the code is authoritative.
|
|
80
346
|
- Don't save things already in **CLAUDE.md**.
|
|
81
|
-
-
|
|
82
|
-
|
|
347
|
+
- **Always rich, always validated**: body authored per `pkf-writing`, `pkf_validate`
|
|
348
|
+
passes before `memory_write` (a v1.1 invalid body is rejected at the write gate).
|
|
349
|
+
- For `feedback` and `project` types, include a **Why** section and a **How to apply**
|
|
350
|
+
section so future-you can judge edge cases.
|
|
351
|
+
- Convert relative dates to **absolute dates** before writing.
|
|
83
352
|
- If a fact may become stale, embed the condition or date that makes it valid.
|
|
84
353
|
|
|
85
354
|
### Read / Recall
|
|
86
355
|
|
|
87
|
-
-
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
|
|
91
|
-
-
|
|
356
|
+
- Follow the **three-stage recall protocol** above: structure route → semantic search →
|
|
357
|
+
navigation fallback. Never re-derive structure the injected digest already answered.
|
|
358
|
+
- On a miss, read `navigation.startPoints` as **routing**, never as results, and walk
|
|
359
|
+
them (children → batch read → links). Do not quote a start point as an answer.
|
|
360
|
+
- Treat recall results as **leads, not evidence**. `tier` tells you what kind of lead:
|
|
361
|
+
`wiki` is curated, `raw` is somebody's upload — verify a `raw` hit before relying on it.
|
|
362
|
+
- `memory_load` returns the page's outbound `links` — follow them to navigate the graph.
|
|
363
|
+
- **No circular recall:** pages already in your context are known — do not re-query them.
|
|
364
|
+
- Don't let memory **override explicit current user instructions** — trust the current
|
|
365
|
+
input and update or remove the stale entry.
|
|
366
|
+
- Before recommending action based on memory that names a specific function/file/flag,
|
|
367
|
+
**verify it still exists** (grep / read). Memory is frozen in time.
|
|
368
|
+
- For *current* or *recent* state ("what changed this week"), prefer `git log` over
|
|
369
|
+
recalling activity-log memories.
|
|
370
|
+
|
|
371
|
+
### Delete / Maintain
|
|
372
|
+
|
|
373
|
+
- When updating an outdated memory, **prefer extending/editing** over deleting + rewriting.
|
|
374
|
+
- When the user says "forget X", search first, confirm the match, then delete. Don't
|
|
375
|
+
silently fail if recall finds nothing — tell the user.
|
|
376
|
+
- **Consolidation / Dream** (merge duplicates, promote hubs, rebuild hub TOCs,
|
|
377
|
+
maintain overviews, split oversized hubs) is a separate, orchestrator-gated
|
|
378
|
+
capability — see the **memory-dream** skill. Do not consolidate from this skill.
|
|
379
|
+
|
|
380
|
+
## Authority & role boundaries (product209/16 MA-2)
|
|
381
|
+
|
|
382
|
+
Memory reads/writes are adjudicated per request by the workspace Memory
|
|
383
|
+
authority. The verdict you receive is final for that request:
|
|
384
|
+
|
|
385
|
+
- **owner (human)** — full authority: decides cross-scope approvals (202
|
|
386
|
+
deferrals), grants read / read+write ACLs; curate and replicate rights
|
|
387
|
+
originate here.
|
|
388
|
+
- **orchestrator (appointed agent, `orchestratorAgentId`)** — may curate the
|
|
389
|
+
shared graph (promote / supersede / rebuild — see **memory-dream**). It does
|
|
390
|
+
NOT automatically pierce member/deputy private scopes.
|
|
391
|
+
- **deputy** — represents exactly its active bound member (a human principal).
|
|
392
|
+
Its authority IS the member's — never the owner's, never the workspace's.
|
|
393
|
+
- **member / member's deputy** — own private pages + workspace-shared pages;
|
|
394
|
+
cannot read or curate another member's private pages.
|
|
395
|
+
- **unbound specialist** — has NO owner/member mapping. Only a live
|
|
396
|
+
role/task/council scope grants reads; outside that scope, expect deny.
|
|
92
397
|
|
|
93
|
-
|
|
398
|
+
Outcome discipline:
|
|
94
399
|
|
|
95
|
-
-
|
|
96
|
-
|
|
400
|
+
- **`403 deny`** — final for this request. Do NOT retry verbatim, do NOT ask
|
|
401
|
+
another agent to read the target for you.
|
|
402
|
+
- **`202 approval deferred`** — the request waits on the data owner. Do NOT
|
|
403
|
+
re-issue it; the approval record already exists and re-submitting spams the
|
|
404
|
+
owner.
|
|
405
|
+
- **local replica states** (`suspended` / `reconciling` / `stale` / authority
|
|
406
|
+
lease expired) — local reads fail closed until the replica reconciles.
|
|
407
|
+
Retry after reconcile; a fail-closed read is never "memory is empty".
|
|
408
|
+
|
|
409
|
+
Role templates do not automatically grant a human principal: an agent whose
|
|
410
|
+
role mentions curation still needs the appointed orchestrator binding before
|
|
411
|
+
`memory_curate` write verbs succeed.
|
|
412
|
+
|
|
413
|
+
## Anti-patterns
|
|
414
|
+
|
|
415
|
+
- ❌ **Re-reading a raw file or the internet when memory already distills it.**
|
|
416
|
+
- ❌ **Circular recall** — re-querying pages already in your context.
|
|
417
|
+
- ❌ **Counting a one-line digest mention as covered** — the exemption is the digest
|
|
418
|
+
naming the exact hub/page that answers; anything less runs the hybrid first round.
|
|
419
|
+
- ❌ **Duplicate extraction** — writing a near-duplicate page when browse/recall showed
|
|
420
|
+
an existing page on the topic. Extend it (`append-section` / `rewrite-section`).
|
|
421
|
+
- ❌ **Copying an Asset/inline PKF body into a page just because it is PKF.** Distill
|
|
422
|
+
durable knowledge, or use explicit exact inline materialization when requested.
|
|
423
|
+
- ❌ **Hand-editing a hub's `#toc`** or storing a duplicate INDEX TOC.
|
|
424
|
+
- ❌ Orphan leaves, guessed paths.
|
|
425
|
+
- ❌ Whole-page-rewriting a page another agent authored — section ops exist; use them.
|
|
426
|
+
- ❌ Persisting a body that failed `pkf_validate` (the write gate will reject it anyway
|
|
427
|
+
— fix the diagnostics instead of retrying verbatim).
|
|
428
|
+
- ❌ **Reading `navigation.startPoints` as a ranked answer** — they are routing entries;
|
|
429
|
+
the answer comes from walking them.
|
|
430
|
+
- ❌ **Squeezing an oversized source into one page** — shard it (422 `sharding_required`
|
|
431
|
+
is the gate telling you so), never truncate the knowledge to fit.
|
|
97
432
|
|
|
98
433
|
## Output reporting
|
|
99
434
|
|
|
100
|
-
After writing memory, echo the path, type,
|
|
435
|
+
After writing memory, echo the path, type, placement (which hub it attached under, or
|
|
436
|
+
which page/section it extended), and one-line description back to the user so they can
|
|
437
|
+
verify what got persisted.
|
|
438
|
+
|
|
439
|
+
After recalling, list match titles + paths + scores; do **not** paste full page content
|
|
440
|
+
unless the user asks — follow up with `memory_load` for any specific hit. If you
|
|
441
|
+
navigated from `navigation.startPoints`, say which start point led to the answer.
|
|
442
|
+
|
|
443
|
+
## CLI appendix (code agents in a shell)
|
|
444
|
+
|
|
445
|
+
Code agents (claude-code / codex / opencode) running in a shell can use the `prismer
|
|
446
|
+
memory` CLI — workspace + identity default from the agent env, output is JSON:
|
|
447
|
+
|
|
448
|
+
```bash
|
|
449
|
+
prismer memory recall "what database did we choose?" # = memory_search
|
|
450
|
+
prismer memory search --queries '["q1","q2"]' # batch recall, one call (daemon cuts at 8 + flags `truncated`)
|
|
451
|
+
prismer memory read "decisions/database-choice.pkf" # = memory_load (also path#section)
|
|
452
|
+
prismer memory load-batch <path1> <path2> ... # up to 10 pages in one call, per-path verdict
|
|
453
|
+
prismer memory list --page-type hub # hub listing
|
|
454
|
+
prismer memory write --path "<path>" --content '<PKF>' # = memory_write (content also via stdin)
|
|
455
|
+
prismer memory delete <pageId>
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
`prismer memory curate` carries the maintenance verbs (`candidates`, `promote-to-hub
|
|
459
|
+
--child-paths`, `supersede`, `rebuild-index`) plus the section-level ones
|
|
460
|
+
(`section-merge`, `section-supersede`, `rewire`) — `--help` lists each command's flags.
|
|
101
461
|
|
|
102
|
-
|
|
462
|
+
> The CLI currently lags the native tools on browse (`memory_browse` has no CLI
|
|
463
|
+
> subcommand yet), so on the shell surface decide placement with
|
|
464
|
+
> `list --page-type hub` + `recall`. Every OTHER write parameter exists on the CLI
|
|
465
|
+
> under its kebab-case name.
|
|
103
466
|
|
|
104
467
|
## Backing capabilities (D22 mapping)
|
|
105
468
|
|
|
106
469
|
Replaces these v1.x built-in skills: `memory-read`, `memory-write`, `memory-recall`.
|
|
470
|
+
Compatibility alias: `memory-curation` (old slug/skillId/ACK resolves to this skill —
|
|
471
|
+
one canonical delivery).
|