@agfpd/iapeer-memory 0.2.7 → 0.2.9
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/package.json +2 -2
- package/src/cli.ts +17 -7
- package/src/commands/archive-stale.ts +87 -0
- package/src/commands/dream-collect.ts +645 -0
- package/src/commands/hook.ts +197 -28
- package/src/commands/init.ts +11 -2
- package/src/commands/render.ts +4 -1
- package/src/commands/update.ts +13 -2
- package/src/commands/verify.ts +20 -3
- package/src/fleet.ts +1 -1
- package/src/paths.ts +7 -0
- package/src/provision.ts +23 -0
- package/src/templates/roles-en.ts +82 -56
- package/src/templates/roles-ru.ts +80 -51
- package/src/watcher.ts +56 -14
- package/src/commands/dream-paths.ts +0 -153
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agfpd/iapeer-memory",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "iapeer-memory — peer memory for the iapeer ecosystem: vault, memoryd (index/search/MCP-http), layer-5 context fragments, role doctrines. The package IS the system; the claude/codex plugins are thin session sockets (docs/10-distribution.md, ADR-009).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@agfpd/iapeer-memory-core": "0.2.
|
|
30
|
+
"@agfpd/iapeer-memory-core": "0.2.9"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/bun": "^1.2.0",
|
package/src/cli.ts
CHANGED
|
@@ -24,7 +24,8 @@ import { cmdInit } from "./commands/init.js";
|
|
|
24
24
|
import { cmdInstallBinary } from "./commands/install-binary.js";
|
|
25
25
|
import { cmdMemoryd } from "./commands/memoryd.js";
|
|
26
26
|
import { cmdMigrate } from "./commands/migrate.js";
|
|
27
|
-
import {
|
|
27
|
+
import { cmdDreamCollect } from "./commands/dream-collect.js";
|
|
28
|
+
import { cmdArchiveStale } from "./commands/archive-stale.js";
|
|
28
29
|
import { cmdProvisionPeer, cmdUnprovisionPeer } from "./commands/provision-peer.js";
|
|
29
30
|
import { cmdRender } from "./commands/render.js";
|
|
30
31
|
import { cmdStatus } from "./commands/status.js";
|
|
@@ -62,10 +63,17 @@ Commands:
|
|
|
62
63
|
fm-update [ops] FILE... structural frontmatter edits + attribution stamp
|
|
63
64
|
migrate --source DIR move harness auto-memory into the vault
|
|
64
65
|
(dry-run by default; --apply to execute)
|
|
65
|
-
dream-
|
|
66
|
-
memory folders
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
dream-collect [--gate] deterministic weekly-tick pre-filter (zero LLM):
|
|
67
|
+
active agent-memory folders in the 7d window +
|
|
68
|
+
candidate flags + resolved transcript files +
|
|
69
|
+
batched tasks, from the LIVE registry (read-only).
|
|
70
|
+
--gate: no output, exit 0 iff there is work (the
|
|
71
|
+
notifier check that decides if DreamWeaver wakes)
|
|
72
|
+
archive-stale [--commit] deliberate backlog archiver (lean §2.2a): move
|
|
73
|
+
pre-existing stale notes to the archive. Dry-run by
|
|
74
|
+
default (lists what would move); --commit executes.
|
|
75
|
+
03_Projects is excluded; memoryd archives ongoing
|
|
76
|
+
staleness incrementally on its own.
|
|
69
77
|
render index|fragment|doctrine|guide
|
|
70
78
|
render one artifact explicitly (memoryd does this
|
|
71
79
|
continuously; render is the manual/scripted path)
|
|
@@ -130,8 +138,10 @@ export async function main(argv: string[]): Promise<number> {
|
|
|
130
138
|
return cmdUpdate(rest, egress);
|
|
131
139
|
case "install-binary":
|
|
132
140
|
return cmdInstallBinary(rest, egress);
|
|
133
|
-
case "dream-
|
|
134
|
-
return
|
|
141
|
+
case "dream-collect":
|
|
142
|
+
return cmdDreamCollect(rest, egress);
|
|
143
|
+
case "archive-stale":
|
|
144
|
+
return cmdArchiveStale(rest);
|
|
135
145
|
case "provision-peer":
|
|
136
146
|
return cmdProvisionPeer(rest, egress);
|
|
137
147
|
case "unprovision-peer":
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `iapeer-memory archive-stale [--commit]` — the DELIBERATE backlog archiver
|
|
3
|
+
* (lean §2.2a, decision boris 15.06).
|
|
4
|
+
*
|
|
5
|
+
* memoryd archives notes incrementally as they BECOME stale (an edit fires the
|
|
6
|
+
* change pass). Pre-existing stale notes are NOT swept on startup (that would
|
|
7
|
+
* be a mass move as a side-effect of a daemon boot — banned by §1: bulk
|
|
8
|
+
* actions are deliberate and verifiable). This verb is that deliberate path:
|
|
9
|
+
*
|
|
10
|
+
* archive-stale DRY-RUN — list what would move + a count
|
|
11
|
+
* archive-stale --commit actually move them
|
|
12
|
+
*
|
|
13
|
+
* `03_Projects` is excluded (a completed phase is a project record, not
|
|
14
|
+
* displaced knowledge — `isArchivableZone`). memoryd reindexes the moves on
|
|
15
|
+
* its next pass (or on restart); the verb itself only moves files.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import fs from "node:fs";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import {
|
|
21
|
+
configFromEnv,
|
|
22
|
+
snapshotVault,
|
|
23
|
+
shouldArchive,
|
|
24
|
+
archiveTargetRel,
|
|
25
|
+
} from "@agfpd/iapeer-memory-core";
|
|
26
|
+
|
|
27
|
+
export function cmdArchiveStale(argv: string[]): number {
|
|
28
|
+
const commit = argv.includes("--commit");
|
|
29
|
+
const config = configFromEnv();
|
|
30
|
+
const vault = config.vaultPath;
|
|
31
|
+
const taxonomy = config.taxonomy;
|
|
32
|
+
|
|
33
|
+
// Candidates: notes in the monitored content folders carrying a final
|
|
34
|
+
// status, EXCLUDING 03_Projects (filtered by shouldArchive → isArchivableZone).
|
|
35
|
+
const snap = snapshotVault(vault, taxonomy);
|
|
36
|
+
const reserved = new Set<string>(); // archive targets claimed within this run
|
|
37
|
+
const moves: Array<{ from: string; to: string }> = [];
|
|
38
|
+
for (const rel of snap.keys()) {
|
|
39
|
+
let content: string;
|
|
40
|
+
try {
|
|
41
|
+
content = fs.readFileSync(path.join(vault, rel), "utf-8");
|
|
42
|
+
} catch {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (!shouldArchive(rel, content, taxonomy)) continue;
|
|
46
|
+
const to = archiveTargetRel(
|
|
47
|
+
path.basename(rel),
|
|
48
|
+
taxonomy,
|
|
49
|
+
(r) => reserved.has(r) || fs.existsSync(path.join(vault, r)),
|
|
50
|
+
);
|
|
51
|
+
reserved.add(to);
|
|
52
|
+
moves.push({ from: rel, to });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (moves.length === 0) {
|
|
56
|
+
console.log("archive-stale: no stale notes outside the archive — nothing to do.");
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!commit) {
|
|
61
|
+
console.log(
|
|
62
|
+
`archive-stale (DRY-RUN): ${moves.length} stale note(s) WOULD move to ${taxonomy.folders.archive}/:`,
|
|
63
|
+
);
|
|
64
|
+
for (const m of moves) console.log(` ${m.from} → ${m.to}`);
|
|
65
|
+
console.log(
|
|
66
|
+
`\nPass --commit to move them. (03_Projects is excluded — completed phases stay project-local.)`,
|
|
67
|
+
);
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let moved = 0;
|
|
72
|
+
for (const m of moves) {
|
|
73
|
+
const toAbs = path.join(vault, m.to);
|
|
74
|
+
try {
|
|
75
|
+
fs.mkdirSync(path.dirname(toAbs), { recursive: true });
|
|
76
|
+
fs.renameSync(path.join(vault, m.from), toAbs);
|
|
77
|
+
moved += 1;
|
|
78
|
+
console.log(` moved: ${m.from} → ${m.to}`);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
console.error(` FAILED: ${m.from} (${String(err)})`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
console.log(
|
|
84
|
+
`archive-stale: moved ${moved}/${moves.length}. memoryd reindexes on its next pass (or restart).`,
|
|
85
|
+
);
|
|
86
|
+
return 0;
|
|
87
|
+
}
|