@inkobytes/nexus 1.0.7 → 1.0.8
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 +6 -0
- package/README.md +28 -1
- package/bin/nexus.js +5 -1
- package/docs/hooks.md +94 -0
- package/docs/nexus-dynamic-governed-loops.md +135 -0
- package/package.json +2 -1
- package/skills/nexus/SKILL.md +10 -4
- package/src/commands/doctor.js +79 -189
- package/src/commands/hooks.js +305 -0
- package/src/commands/init.js +7 -172
- package/src/lib/protocolText.js +196 -0
package/src/commands/init.js
CHANGED
|
@@ -7,6 +7,12 @@ import { join } from 'path';
|
|
|
7
7
|
import { cwd } from 'process';
|
|
8
8
|
import { AGENT_SCOPE_ENTRIES } from '../lib/agentScopes.js';
|
|
9
9
|
import { DEFAULT_MATRIX } from '../lib/permissions.js';
|
|
10
|
+
import {
|
|
11
|
+
CONTINUITY_TEMPLATE,
|
|
12
|
+
MEMORY_INDEX_TEMPLATE,
|
|
13
|
+
currentMemoryMonthFolder,
|
|
14
|
+
fullEntrypoint,
|
|
15
|
+
} from '../lib/protocolText.js';
|
|
10
16
|
|
|
11
17
|
const TEMPLATES = {
|
|
12
18
|
'_NEXUS.md': '',
|
|
@@ -304,177 +310,6 @@ docs-priv/
|
|
|
304
310
|
*.flock
|
|
305
311
|
`;
|
|
306
312
|
|
|
307
|
-
const CONTINUITY_TEMPLATE = `# CONTINUITY
|
|
308
|
-
Goal: Project setup
|
|
309
|
-
State: Planning
|
|
310
|
-
|
|
311
|
-
Now: Initial Nexus setup
|
|
312
|
-
Next: Confirm first task
|
|
313
|
-
Blockers: None
|
|
314
|
-
Decisions:
|
|
315
|
-
- Nexus manages swarm coordination
|
|
316
|
-
- Continuity and memories are agent-local
|
|
317
|
-
Files:
|
|
318
|
-
- _NEXUS_QUEUE.md
|
|
319
|
-
- _NEXUS_STANDUP.md
|
|
320
|
-
`;
|
|
321
|
-
|
|
322
|
-
const MEMORY_INDEX_TEMPLATE = `# Memory Index
|
|
323
|
-
|
|
324
|
-
Newest first, max 10 visible entries.
|
|
325
|
-
|
|
326
|
-
Format:
|
|
327
|
-
|
|
328
|
-
- YYYY-Month/YYYY-MM-DD-HHMM-topic.md - short session label
|
|
329
|
-
|
|
330
|
-
Entries live in month folders from the start, for example:
|
|
331
|
-
|
|
332
|
-
- \`2026-January/2026-01-15-1030-project-setup.md\`
|
|
333
|
-
- \`2026-February/2026-02-01-0900-debug-session.md\`
|
|
334
|
-
|
|
335
|
-
This keeps monthly review simple: ask an agent to read one month folder and summarize the Markdown files.
|
|
336
|
-
|
|
337
|
-
`;
|
|
338
|
-
|
|
339
|
-
const MONTH_NAMES = [
|
|
340
|
-
'January',
|
|
341
|
-
'February',
|
|
342
|
-
'March',
|
|
343
|
-
'April',
|
|
344
|
-
'May',
|
|
345
|
-
'June',
|
|
346
|
-
'July',
|
|
347
|
-
'August',
|
|
348
|
-
'September',
|
|
349
|
-
'October',
|
|
350
|
-
'November',
|
|
351
|
-
'December',
|
|
352
|
-
];
|
|
353
|
-
|
|
354
|
-
const START_MARKER = '<!-- NEXUS-AGENT-PROTOCOL:START -->';
|
|
355
|
-
const END_MARKER = '<!-- NEXUS-AGENT-PROTOCOL:END -->';
|
|
356
|
-
|
|
357
|
-
function currentMemoryMonthFolder(now = new Date()) {
|
|
358
|
-
return `${now.getFullYear()}-${MONTH_NAMES[now.getMonth()]}`;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
function agentEntrypointTemplate(scaffold) {
|
|
362
|
-
return `# ${scaffold.label} Agent Guide
|
|
363
|
-
|
|
364
|
-
${START_MARKER}
|
|
365
|
-
|
|
366
|
-
## Nexus Project Protocol
|
|
367
|
-
|
|
368
|
-
This project uses Nexus for multi-agent coordination.
|
|
369
|
-
|
|
370
|
-
### Start Here
|
|
371
|
-
|
|
372
|
-
1. Read \`_NEXUS_CONSTITUTION.md\`.
|
|
373
|
-
2. Read \`_NEXUS_QUEUE.md\` for executable priorities.
|
|
374
|
-
3. Read \`_NEXUS_STANDUP.md\` for comms, decisions, and completion notes.
|
|
375
|
-
4. Read \`USER.md\` if present for local human preferences.
|
|
376
|
-
5. Read \`${scaffold.continuity}\` for current session state.
|
|
377
|
-
6. Read \`${scaffold.memoryIndex}\` and the latest memory entry when resync is needed.
|
|
378
|
-
|
|
379
|
-
### Nexus Rules
|
|
380
|
-
|
|
381
|
-
- Claim before editing shared project files: \`nexus claim <path> @Agent "intent"\`.
|
|
382
|
-
- Nexus is agent-native and file-native, not human-native: optimize for concurrency and rollback, not feature-commit aesthetics.
|
|
383
|
-
- Release each claimed file as soon as it reaches a coherent checkpoint.
|
|
384
|
-
- Never hold claims just to bundle a prettier feature commit; that blocks other agents.
|
|
385
|
-
- Release finished work through Nexus: \`nexus release <path> "commit message"\`.
|
|
386
|
-
- Use \`nexus next @Agent\` for the next safe queue task.
|
|
387
|
-
- Do not free-roam into unassigned or \`Auto-flow: no\` work without user approval.
|
|
388
|
-
- Direct user instruction can override queue order, but not claim/release, data, security, or approval gates.
|
|
389
|
-
- If no safe task remains, announce \`Standby\` with what you are waiting for, then stop until user input, queue change, or explicit assignment.
|
|
390
|
-
|
|
391
|
-
### Current File State
|
|
392
|
-
|
|
393
|
-
- Treat previous chat context, cached model memory, and earlier reads as stale when file contents matter.
|
|
394
|
-
- Before claiming what a file says, making edits, or judging current state, read the file from disk with a fresh command.
|
|
395
|
-
- Treat \`nexus claim\` as the atomic lock-and-read boundary and its output as fresh file state for the claimed path.
|
|
396
|
-
- If you read a shared file before claiming it, treat that read as stale after claim succeeds.
|
|
397
|
-
- If another agent or tool may have touched the file since your last read, re-read it before editing.
|
|
398
|
-
- If a claim appears stale, do not edit through it; run \`nexus status\` or \`nexus doctor\`, then clean only when ownership is clearly abandoned.
|
|
399
|
-
|
|
400
|
-
### Drills
|
|
401
|
-
|
|
402
|
-
Drill guidance is defined in \`_NEXUS_CONSTITUTION.md\`.
|
|
403
|
-
If the situation resembles a drill, use that drill before acting.
|
|
404
|
-
|
|
405
|
-
### Delegated Work
|
|
406
|
-
|
|
407
|
-
- Lead agents own the repo effects of their subagents, tools, and parallel workers.
|
|
408
|
-
- Claim the full path scope before delegating shared-file work.
|
|
409
|
-
- Give subagents the claimed path, intent, non-goals, and boundaries.
|
|
410
|
-
- Re-read affected files after subagent work before final edits, release, or current-state claims.
|
|
411
|
-
- Mention delegated work in release or \`nexus standup\` notes when it affected files, tests, or risk.
|
|
412
|
-
|
|
413
|
-
### Git Write Safety
|
|
414
|
-
|
|
415
|
-
- Before git writes, verify \`pwd\`, repo root, branch/status, and remotes.
|
|
416
|
-
- Stop if they do not match the requested project.
|
|
417
|
-
- Never infer from similar folder names or cached context.
|
|
418
|
-
- Require explicit confirmation before push/force-push, main/master, remote changes, or deletes.
|
|
419
|
-
- To remove private agent files from git, untrack them; do not delete local folders.
|
|
420
|
-
- Agent instruction files are shared protocol files; normal edits require claim/release, while \`nexus doctor --fix\` may update managed protocol blocks after user approval.
|
|
421
|
-
- Agents work inside assigned work zones. If a change crosses work-zone boundaries or alters a shared contract another zone may depend on, announce it in \`_NEXUS_STANDUP.md\` before release and ask if coordination is needed.
|
|
422
|
-
|
|
423
|
-
### Supply-Chain Safety
|
|
424
|
-
|
|
425
|
-
- Do not install third-party packages that have existed for less than 14 days.
|
|
426
|
-
- Before adding a new dependency, verify the package creation date and the specific version publish date.
|
|
427
|
-
- If the package or version is younger than 14 days, or either date cannot be verified, stop and ask the user.
|
|
428
|
-
- Run \`nexus doctor\` before installs; review any Security findings before running package scripts.
|
|
429
|
-
- \`nexus doctor\` is cheap, local, and idempotent.
|
|
430
|
-
- If \`nexus doctor\` reports Security, Package Privacy, Git Privacy, or supply-chain findings, stop and report before fixing or installing.
|
|
431
|
-
- Treat install hooks and scripts with network commands, webhooks, raw sockets, SSH, or secret-looking variables as human-review only.
|
|
432
|
-
- Prefer built-in runtime APIs and existing project dependencies when they fit.
|
|
433
|
-
|
|
434
|
-
### Agent-Local Files
|
|
435
|
-
|
|
436
|
-
\`${scaffold.continuity}\` and \`${scaffold.memoryIndex}\` are agent-local handoff files.
|
|
437
|
-
They are exempt from Nexus claim/release unless the user says otherwise.
|
|
438
|
-
|
|
439
|
-
### Memory Flow
|
|
440
|
-
|
|
441
|
-
- On session start, read \`${scaffold.memoryIndex}\`.
|
|
442
|
-
- If the index has entries, read the newest \`${scaffold.memoryDir}/YYYY-Month/YYYY-MM-DD-HHMM-topic.md\` entry.
|
|
443
|
-
- Durable architecture and protocol decisions belong in \`DECISIONS.md\`; mention them in \`_NEXUS_STANDUP.md\` only when active agents need to coordinate around them.
|
|
444
|
-
- Memory entries are session handoffs.
|
|
445
|
-
- When writing your own memory entry, create the current month folder under \`${scaffold.memoryDir}\` if it is missing.
|
|
446
|
-
- Do not create or repair other agents' memory folders manually; use \`nexus doctor --fix\` for broad scaffold repair.
|
|
447
|
-
- On session end, pause, or checkpoint request:
|
|
448
|
-
1. Run \`nexus checkout @${scaffold.aliases[0]}\` to clear your presence heartbeat.
|
|
449
|
-
2. Create one new memory file: \`${scaffold.memoryDir}/YYYY-Month/YYYY-MM-DD-HHMM-topic.md\`.
|
|
450
|
-
- Add the newest file to the top of \`${scaffold.memoryIndex}\`.
|
|
451
|
-
- Keep the index to the 10 newest visible entries.
|
|
452
|
-
- For monthly review, read one month folder such as \`${scaffold.memoryDir}/2026-January/\` and summarize the Markdown files.
|
|
453
|
-
|
|
454
|
-
Memory entry format:
|
|
455
|
-
|
|
456
|
-
\`\`\`markdown
|
|
457
|
-
# YYYY-MM-DD-HHMM - <topic>
|
|
458
|
-
|
|
459
|
-
## Session Summary
|
|
460
|
-
- What we worked on: [<=50 words]
|
|
461
|
-
- What got done: [bullet list, max 5]
|
|
462
|
-
- Where we stopped: [exact state, <=30 words]
|
|
463
|
-
|
|
464
|
-
## Next Session Needs
|
|
465
|
-
- Immediate next task: [<=20 words]
|
|
466
|
-
- Blockers: [None, or list]
|
|
467
|
-
- Open questions: [if any]
|
|
468
|
-
|
|
469
|
-
## Context to Carry
|
|
470
|
-
- Key decisions made: [max 3 bullets]
|
|
471
|
-
- Files touched: [max 5 paths]
|
|
472
|
-
- Gotchas/warnings: [anything next session should watch for]
|
|
473
|
-
\`\`\`
|
|
474
|
-
|
|
475
|
-
${END_MARKER}
|
|
476
|
-
`;
|
|
477
|
-
}
|
|
478
313
|
|
|
479
314
|
export default function init(args) {
|
|
480
315
|
const root = cwd();
|
|
@@ -539,7 +374,7 @@ export default function init(args) {
|
|
|
539
374
|
if (existsSync(entrypointPath)) {
|
|
540
375
|
console.log(` ⏭ ${scaffold.entrypoint} (already exists)`);
|
|
541
376
|
} else {
|
|
542
|
-
writeFileSync(entrypointPath,
|
|
377
|
+
writeFileSync(entrypointPath, fullEntrypoint(scaffold), 'utf-8');
|
|
543
378
|
console.log(` ✅ ${scaffold.entrypoint}`);
|
|
544
379
|
agentFilesCreated++;
|
|
545
380
|
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
export const MONTH_NAMES = [
|
|
2
|
+
'January',
|
|
3
|
+
'February',
|
|
4
|
+
'March',
|
|
5
|
+
'April',
|
|
6
|
+
'May',
|
|
7
|
+
'June',
|
|
8
|
+
'July',
|
|
9
|
+
'August',
|
|
10
|
+
'September',
|
|
11
|
+
'October',
|
|
12
|
+
'November',
|
|
13
|
+
'December',
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export const START_MARKER = '<!-- NEXUS-AGENT-PROTOCOL:START -->';
|
|
17
|
+
export const END_MARKER = '<!-- NEXUS-AGENT-PROTOCOL:END -->';
|
|
18
|
+
export const REQUIRED_CONTEXT_READ = 'Read continuity and latest memory at session start, `nexus start`, or resume.';
|
|
19
|
+
export const CONTINUITY_LEDGER_LINE = 'Compaction-safe session ledger. Read this first after context loss, restart, or fresh entry.';
|
|
20
|
+
export const SKILL_CONTEXT_GUARDRAIL = 'Continuity is the compaction-safe session ledger; latest memory is required startup/resume context.';
|
|
21
|
+
export const MEMORY_INDEX_GUARDRAIL = 'Memory indexes use monthly folders and newest-first Markdown links with one-line outcomes.';
|
|
22
|
+
|
|
23
|
+
export const CONTINUITY_TEMPLATE = `# CONTINUITY
|
|
24
|
+
|
|
25
|
+
${CONTINUITY_LEDGER_LINE}
|
|
26
|
+
|
|
27
|
+
Goal: Project setup
|
|
28
|
+
State: Planning
|
|
29
|
+
|
|
30
|
+
Now: Initial Nexus setup
|
|
31
|
+
Next: Confirm first task
|
|
32
|
+
Blockers: None
|
|
33
|
+
Decisions:
|
|
34
|
+
- Nexus manages swarm coordination
|
|
35
|
+
- Continuity and memories are agent-local
|
|
36
|
+
Files:
|
|
37
|
+
- _NEXUS_QUEUE.md
|
|
38
|
+
- _NEXUS_STANDUP.md
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
export const MEMORY_INDEX_TEMPLATE = `# Memory Index
|
|
42
|
+
|
|
43
|
+
Newest first, max 10 visible entries.
|
|
44
|
+
|
|
45
|
+
Format:
|
|
46
|
+
|
|
47
|
+
- [YYYY-MM-DD-HHMM-topic](YYYY-Month/YYYY-MM-DD-HHMM-topic.md) - one-line outcome
|
|
48
|
+
|
|
49
|
+
Entries live in month folders from the start, for example:
|
|
50
|
+
|
|
51
|
+
- [2026-01-15-1030-project-setup](2026-January/2026-01-15-1030-project-setup.md) - initialized Nexus scaffolds
|
|
52
|
+
- [2026-02-01-0900-debug-session](2026-February/2026-02-01-0900-debug-session.md) - isolated the failing hook path
|
|
53
|
+
|
|
54
|
+
This keeps monthly review simple: ask an agent to read one month folder and summarize the Markdown files.
|
|
55
|
+
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
export function currentMemoryMonthFolder(now = new Date()) {
|
|
59
|
+
return `${now.getFullYear()}-${MONTH_NAMES[now.getMonth()]}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function protocolBlock(agent) {
|
|
63
|
+
return `${START_MARKER}
|
|
64
|
+
|
|
65
|
+
## Nexus Project Protocol
|
|
66
|
+
|
|
67
|
+
This project uses Nexus for multi-agent coordination.
|
|
68
|
+
|
|
69
|
+
### Start Here
|
|
70
|
+
|
|
71
|
+
1. Read \`_NEXUS_CONSTITUTION.md\`.
|
|
72
|
+
2. Read \`_NEXUS_QUEUE.md\` for executable priorities.
|
|
73
|
+
3. Read \`_NEXUS_STANDUP.md\` for comms, decisions, and completion notes.
|
|
74
|
+
4. Read \`USER.md\` if present for local human preferences.
|
|
75
|
+
5. Read \`${agent.continuity}\` for current session state.
|
|
76
|
+
6. Read \`${agent.memoryIndex}\` and the latest memory entry at session start, \`nexus start\`, or resume.
|
|
77
|
+
|
|
78
|
+
### Nexus Rules
|
|
79
|
+
|
|
80
|
+
- On compaction, resume, or a fresh turn, treat this file and the Nexus protocol as active requirements, not optional guidance.
|
|
81
|
+
- Claim before touching shared project files: \`nexus claim <path> @Agent "intent"\`.
|
|
82
|
+
- If a hook blocks reading, editing, committing, or releasing because a path is unclaimed, stop and claim the exact path. Do not bypass the hook with another tool, shell trick, cached content, or manual git command.
|
|
83
|
+
- Claim first, then read/edit. No exceptions, no "I'll claim after."
|
|
84
|
+
- Nexus is agent-native and file-native, not human-native: optimize for concurrency and rollback, not feature-commit aesthetics.
|
|
85
|
+
- Release each claimed file as soon as it reaches a coherent checkpoint.
|
|
86
|
+
- Never hold claims just to bundle a prettier feature commit; that blocks other agents.
|
|
87
|
+
- Release finished work through Nexus: \`nexus release <path> "commit message"\`.
|
|
88
|
+
- Use \`nexus next @Agent\` for the next safe queue task.
|
|
89
|
+
- Do not free-roam into unassigned or \`Auto-flow: no\` work without user approval.
|
|
90
|
+
- Direct user instruction can override queue order, but not claim/release, data, security, or approval gates.
|
|
91
|
+
- If no safe task remains, announce \`Standby\` with what you are waiting for, then stop until user input, queue change, or explicit assignment.
|
|
92
|
+
|
|
93
|
+
### Current File State
|
|
94
|
+
|
|
95
|
+
- Treat previous chat context, cached model memory, and earlier reads as stale when file contents matter.
|
|
96
|
+
- Unclaimed orientation reads are limited to Nexus protocol, queue, standup, human preference, continuity, and memory files named in Start Here.
|
|
97
|
+
- Claim before reading implementation files, tests, docs, generated artifacts, or agent instruction files outside that orientation set.
|
|
98
|
+
- Before claiming what a file says, making edits, or judging current state, read the file from disk with a fresh command.
|
|
99
|
+
- Treat \`nexus claim\` as the atomic lock-and-read boundary and its output as fresh file state for the claimed path.
|
|
100
|
+
- If you read a shared file before claiming it, treat that read as stale after claim succeeds.
|
|
101
|
+
- If another agent or tool may have touched the file since your last read, re-read it before editing.
|
|
102
|
+
- If a claim appears stale, do not edit through it; run \`nexus status\` or \`nexus doctor\`, then clean only when ownership is clearly abandoned.
|
|
103
|
+
|
|
104
|
+
### Drills
|
|
105
|
+
|
|
106
|
+
Drill guidance is defined in \`_NEXUS_CONSTITUTION.md\`.
|
|
107
|
+
If the situation resembles a drill, use that drill before acting.
|
|
108
|
+
|
|
109
|
+
### Delegated Work
|
|
110
|
+
|
|
111
|
+
- Lead agents own the repo effects of their subagents, tools, and parallel workers.
|
|
112
|
+
- Claim the full path scope before delegating shared-file work.
|
|
113
|
+
- Give subagents the claimed path, intent, non-goals, and boundaries.
|
|
114
|
+
- Re-read affected files after subagent work before final edits, release, or current-state claims.
|
|
115
|
+
- Mention delegated work in release or \`nexus standup\` notes when it affected files, tests, or risk.
|
|
116
|
+
|
|
117
|
+
### Git Write Safety
|
|
118
|
+
|
|
119
|
+
- Before git writes, verify \`pwd\`, repo root, branch/status, and remotes.
|
|
120
|
+
- Stop if they do not match the requested project.
|
|
121
|
+
- Never infer from similar folder names or cached context.
|
|
122
|
+
- Require explicit confirmation before push/force-push, main/master, remote changes, or deletes.
|
|
123
|
+
- To remove private agent files from git, untrack them; do not delete local folders.
|
|
124
|
+
- Agent instruction files are shared protocol files; normal edits require claim/release, while \`nexus doctor --fix\` may update managed protocol blocks after user approval.
|
|
125
|
+
- Agents work inside assigned work zones. If a change crosses work-zone boundaries or alters a shared contract another zone may depend on, announce it in \`_NEXUS_STANDUP.md\` before release and ask if coordination is needed.
|
|
126
|
+
|
|
127
|
+
### Supply-Chain Safety
|
|
128
|
+
|
|
129
|
+
- Do not install third-party packages that have existed for less than 14 days.
|
|
130
|
+
- Before adding a new dependency, verify the package creation date and the specific version publish date.
|
|
131
|
+
- If the package or version is younger than 14 days, or either date cannot be verified, stop and ask the user.
|
|
132
|
+
- Run \`nexus doctor\` before installs; review any Security findings before running package scripts.
|
|
133
|
+
- \`nexus doctor\` is cheap, local, and idempotent.
|
|
134
|
+
- If \`nexus doctor\` reports Security, Package Privacy, Git Privacy, or supply-chain findings, stop and report before fixing or installing.
|
|
135
|
+
- Treat install hooks and scripts with network commands, webhooks, raw sockets, SSH, or secret-looking variables as human-review only.
|
|
136
|
+
- Prefer built-in runtime APIs and existing project dependencies when they fit.
|
|
137
|
+
|
|
138
|
+
### Agent-Local Files
|
|
139
|
+
|
|
140
|
+
\`${agent.continuity}\` and \`${agent.memoryIndex}\` are agent-local handoff files.
|
|
141
|
+
They are exempt from Nexus claim/release unless the user says otherwise.
|
|
142
|
+
|
|
143
|
+
### Continuity Flow
|
|
144
|
+
|
|
145
|
+
- Continuity is the compaction-safe session ledger.
|
|
146
|
+
- On session start, read \`${agent.continuity}\` once and treat it as current state unless the user contradicts it.
|
|
147
|
+
- Write continuity only on task switch, blocker, checkpoint request, or session end.
|
|
148
|
+
- Replace the ledger instead of appending to it.
|
|
149
|
+
- In task replies, use a one-line status summary instead of echoing the full ledger.
|
|
150
|
+
- If the ledger is missing, stale, or lacks referenced context, ask once instead of guessing.
|
|
151
|
+
|
|
152
|
+
### Memory Flow
|
|
153
|
+
|
|
154
|
+
- On session start, \`nexus start\`, or resume, read \`${agent.memoryIndex}\`, then read the newest linked entry.
|
|
155
|
+
- Memory entries are session handoffs, not permanent system truth.
|
|
156
|
+
- Durable architecture and protocol decisions belong in \`DECISIONS.md\`; mention them in \`_NEXUS_STANDUP.md\` only when active agents need to coordinate around them.
|
|
157
|
+
- Write memory once per session, only when the user asks, or on session end, pause, or checkpoint request.
|
|
158
|
+
- When writing your own memory entry, create the current month folder under \`${agent.memoryDir}\` if it is missing.
|
|
159
|
+
- Do not create or repair other agents' memory folders manually; use \`nexus doctor --fix\` for broad scaffold repair.
|
|
160
|
+
- On session end, pause, or checkpoint request:
|
|
161
|
+
1. Run \`nexus checkout @${agent.aliases[0]}\` to clear your presence heartbeat.
|
|
162
|
+
2. Create one new memory file: \`${agent.memoryDir}/YYYY-Month/YYYY-MM-DD-HHMM-topic.md\`.
|
|
163
|
+
- Add the newest file to the top of \`${agent.memoryIndex}\` as a Markdown link plus one-line outcome.
|
|
164
|
+
- Keep the index to the 10 newest visible entries.
|
|
165
|
+
- For monthly review, read one month folder such as \`${agent.memoryDir}/2026-January/\` and summarize the Markdown files.
|
|
166
|
+
|
|
167
|
+
Memory entry format:
|
|
168
|
+
|
|
169
|
+
\`\`\`markdown
|
|
170
|
+
# YYYY-MM-DD - HH:MM - <topic>
|
|
171
|
+
|
|
172
|
+
## Session Summary
|
|
173
|
+
- What we worked on: [<=50 words]
|
|
174
|
+
- What got done: [bullet list, max 5]
|
|
175
|
+
- Where we stopped: [exact state, <=30 words]
|
|
176
|
+
|
|
177
|
+
## Next Session Needs
|
|
178
|
+
- Immediate next task: [<=20 words]
|
|
179
|
+
- Blockers: [None, or list]
|
|
180
|
+
- Open questions: [if any]
|
|
181
|
+
|
|
182
|
+
## Context to Carry
|
|
183
|
+
- Key decisions made: [max 3 bullets]
|
|
184
|
+
- Files touched: [max 5 paths]
|
|
185
|
+
- Gotchas/warnings: [anything next session should watch for]
|
|
186
|
+
\`\`\`
|
|
187
|
+
|
|
188
|
+
${END_MARKER}
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function fullEntrypoint(agent) {
|
|
193
|
+
return `# ${agent.label} Agent Guide
|
|
194
|
+
|
|
195
|
+
${protocolBlock(agent)}`;
|
|
196
|
+
}
|