@inkobytes/nexus 1.0.6 → 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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.8 - 2026-06-10
4
+
5
+ - Added a shared protocol wording source so `nexus init`, `nexus doctor`, README repair, and tests stay aligned.
6
+ - Tightened generated agent protocol around required continuity/latest-memory reads and claim-before-read/edit behavior.
7
+ - Added `nexus hooks install --agent all` for installing Codex, Claude, and Gemini guard hooks in one pass.
8
+
9
+ ## 1.0.7 - 2026-06-06
10
+
11
+ - Added `nexus install-skill` to install the bundled Nexus skill into `~/.agents/skills/nexus`.
12
+ - Added `--target` and `--force` options for custom or refreshed skill installs, with a guard against broad overwrite targets.
13
+ - Updated help, zsh completion, README docs, and regression coverage for the new skill installer command.
14
+
3
15
  ## 1.0.6 - 2026-06-03
4
16
 
5
17
  - Extended Nexus protocol drift checks so `nexus doctor` now covers the bundled `skills/nexus/SKILL.md`.
package/README.md CHANGED
@@ -71,6 +71,7 @@ Requires Node.js 18 or newer.
71
71
 
72
72
  - Colorized `nexus help` output for easier scanning in the terminal
73
73
  - Built-in `nexus completion zsh` support for shell completions
74
+ - Bundled `nexus install-skill` support for installing the Nexus agent skill into `~/.agents/skills`
74
75
 
75
76
  See [CHANGELOG.md](./CHANGELOG.md) for the release summary.
76
77
 
@@ -132,6 +133,12 @@ Memory folders are month-based from the start, for example:
132
133
  .gemini/memories/2026-May/
133
134
  ```
134
135
 
136
+ Memory indexes stay newest-first and link to entries with one-line outcomes:
137
+
138
+ ```md
139
+ - [2026-06-09-1430-hook-protocol-fix](2026-June/2026-06-09-1430-hook-protocol-fix.md) - tightened hook claim guidance
140
+ ```
141
+
135
142
  If you only want to inspect an existing repo before changing anything, run:
136
143
 
137
144
  ```bash
@@ -240,6 +247,37 @@ source <(nexus completion zsh)
240
247
 
241
248
  This gives `zsh` tab-completion for commands like `claim`, `release`, `doctor`, `drill`, and common agent handles such as `@codex` and `@claude`.
242
249
 
250
+ ### `nexus install-skill [--target <path>] [--force]`
251
+
252
+ Install the bundled Nexus agent skill into the shared agent skill directory.
253
+
254
+ ```bash
255
+ nexus install-skill
256
+ nexus install-skill --force
257
+ nexus install-skill --target ~/.agents/skills/nexus
258
+ ```
259
+
260
+ By default, Nexus copies `skills/nexus` from the published package into `~/.agents/skills/nexus`. Restart or refresh your agent session after installing so its skill registry can discover the new `nexus` skill.
261
+
262
+ ### `nexus hooks install --agent @codex|@claude|@gemini|all [--target <path>] [--force]`
263
+
264
+ Install an agent-specific local guard hook.
265
+
266
+ ```bash
267
+ nexus hooks install --agent @codex
268
+ nexus hooks install --agent @claude
269
+ nexus hooks install --agent @gemini
270
+ nexus hooks install --agent all
271
+ ```
272
+
273
+ Hooks block writes in Nexus repos until the exact target path is claimed, then give the agent a compact recovery command. Each hook uses the matching claim handle, so Codex sees `@codex`, Claude sees `@claude`, and Gemini sees `@gemini`.
274
+
275
+ Use `--agent all` to install the default Codex, Claude, and Gemini hooks in one pass. `--target` is only for single-agent installs.
276
+
277
+ Hook installation writes outside the repo, so `nexus doctor --fix` does not install hooks. Use `nexus doctor --hooks` to report missing, foreign, wrong-agent, or current hooks.
278
+
279
+ See [docs/hooks.md](./docs/hooks.md) for install targets and behavior.
280
+
243
281
  ### `nexus ledger [--json]`
244
282
 
245
283
  Show completed task entries from `_NEXUS_LEDGER.md`.
@@ -412,7 +450,7 @@ The agent rule of thumb:
412
450
  1. Run `nexus start` when entering an existing repo; it does not replace claim/release.
413
451
  2. Read `_NEXUS_CONSTITUTION.md`.
414
452
  3. Read `USER.md` when present.
415
- 4. Read continuity and latest memory when present.
453
+ 4. Read continuity and latest memory at session start, `nexus start`, or resume.
416
454
  5. Read `_NEXUS_QUEUE.md` before taking follow-on work.
417
455
  6. Claim before touching shared project files.
418
456
  7. Release each claimed tracked file as soon as it reaches a coherent checkpoint.
@@ -452,6 +490,8 @@ Nexus ships an agent skill at `skills/nexus/SKILL.md`.
452
490
 
453
491
  The CLI is the coordination engine. The skill is the lean playbook for this flow: `start -> claim -> work -> release -> next`.
454
492
 
493
+ Generated agent protocol text lives in `src/lib/protocolText.js`. Update that module first when changing shared protocol wording, then run doctor/init tests so scaffolded guides, README repair, and the bundled skill stay aligned.
494
+
455
495
  ## Legacy Helper Transition
456
496
 
457
497
  Older Nexus experiments used shell helpers:
package/bin/nexus.js CHANGED
@@ -19,13 +19,15 @@ const COMMANDS = {
19
19
  metrics: () => import('../src/commands/metrics.js'),
20
20
  ledger: () => import('../src/commands/ledger.js'),
21
21
  drill: () => import('../src/commands/drill.js'),
22
+ hooks: () => import('../src/commands/hooks.js'),
22
23
  soul: () => import('../src/commands/soul.js'),
24
+ 'install-skill': () => import('../src/commands/install-skill.js'),
23
25
  chmod: () => import('../src/commands/chmod.js'),
24
26
  db: () => import('../src/commands/db.js'),
25
27
  help: () => import('../src/commands/help.js'),
26
28
  };
27
29
 
28
- const VERSION = '1.0.1';
30
+ const VERSION = '1.0.8';
29
31
  const COLORS = createColors();
30
32
 
31
33
  const args = argv.slice(2);
@@ -75,7 +77,9 @@ function printHelp() {
75
77
  ['chmod [--list] [--init]', 'Show or set promptCHMOD permissions'],
76
78
  ['db <backup|list|restore|schedule>', 'Database backup and recovery'],
77
79
  ['drill <list|show|run|report>', 'Inspect or run protocol drills'],
80
+ ['hooks install --agent @handle|all', 'Install agent-specific local guard hooks'],
78
81
  ['soul [--file <path>] [--status | --remove]', 'Manage local soul overlay in agent files'],
82
+ ['install-skill [--target <path>] [--force]', 'Install bundled Nexus skill into ~/.agents/skills'],
79
83
  ['help', 'Show this help'],
80
84
  ];
81
85
 
@@ -89,6 +93,9 @@ function printHelp() {
89
93
  'nexus metrics --json',
90
94
  'nexus ledger backfill',
91
95
  'nexus drill show wrong-repo-push',
96
+ 'nexus hooks install --agent @codex',
97
+ 'nexus hooks install --agent all',
98
+ 'nexus install-skill',
92
99
  'nexus claim src/lib/components/login/ @claude "Building login UI"',
93
100
  'nexus release src/lib/components/login/ "feat: login form component"',
94
101
  'nexus standup "2026-06-01 08:38 AM @codex [DONE]: Updated tests"',
package/docs/hooks.md ADDED
@@ -0,0 +1,94 @@
1
+ # Nexus Hooks
2
+
3
+ Nexus hooks are optional local guardrails for agent CLIs. They block file writes in Nexus repos until the target path has a matching Nexus claim.
4
+
5
+ Hooks are useful because agent instruction files can be forgotten after context compaction. The hook gives the agent a short recovery command instead of letting it edit around the protocol.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ nexus hooks install --agent @codex
11
+ nexus hooks install --agent @claude
12
+ nexus hooks install --agent @gemini
13
+ nexus hooks install --agent all
14
+ ```
15
+
16
+ Supported agents:
17
+
18
+ - `@codex`
19
+ - `@claude`
20
+ - `@gemini`
21
+
22
+ Each installed hook bakes in the matching claim handle, so a Codex hook says `@codex`, a Claude hook says `@claude`, and a Gemini hook says `@gemini`.
23
+
24
+ Use `--agent all` to install all default Codex, Claude, and Gemini hooks in one pass. `--target` is only available for a single agent because each agent has a different default file.
25
+
26
+ ## Default Targets
27
+
28
+ ```text
29
+ @codex -> ~/.codex/hooks/pre_tool_use_guard.py
30
+ @claude -> ~/.claude/hooks/nexus_pre_tool_use_guard.py
31
+ @gemini -> ~/.gemini/hooks/nexus_pre_tool_use_guard.py
32
+ ```
33
+
34
+ Use `--target` when your agent CLI needs a different hook path:
35
+
36
+ ```bash
37
+ nexus hooks install --agent @codex --target ~/.codex/hooks/pre_tool_use_guard.py
38
+ ```
39
+
40
+ If a hook file already exists, Nexus does not overwrite it unless it is already a current Nexus hook. Use `--force` only after reviewing the existing file:
41
+
42
+ ```bash
43
+ nexus hooks install --agent @codex --force
44
+ ```
45
+
46
+ ## What The Hook Blocks
47
+
48
+ The hook looks for writes to files in a Nexus repo. If the file is not claimed, it denies the tool call with a compact message:
49
+
50
+ ```text
51
+ CLAIM FIRST: README.md
52
+ cd /path/to/repo && nexus claim README.md @codex "Describe the edit"
53
+ Retry edit. No workaround.
54
+ ```
55
+
56
+ For multiple files, it adds:
57
+
58
+ ```text
59
+ If multiple files are listed, claim each exact path.
60
+ ```
61
+
62
+ The hook discovers the Nexus repo root from the target path or current working directory. It checks the real Nexus lock path encoding, including nested paths such as `docs~2Fguide.md.lock`.
63
+
64
+ ## Claim Exemptions
65
+
66
+ The hook allows agent-local continuity and memory handoff files without a claim:
67
+
68
+ - `.codex/CONTINUITY.md`
69
+ - `.codex/memories/`
70
+ - `.claude/CONTINUITY.md`
71
+ - `.claude/memories/`
72
+ - `.gemini/CONTINUITY.md`
73
+ - `.gemini/memories/`
74
+
75
+ Agent instruction files such as `.codex/AGENTS.md`, `.claude/CLAUDE.md`, and `.gemini/GEMINI.md` still require claim/release when they are shared project files.
76
+
77
+ ## Doctor Check
78
+
79
+ Hook installation writes outside the repo, so `nexus doctor --fix` does not install or replace hooks.
80
+
81
+ To audit hook status explicitly:
82
+
83
+ ```bash
84
+ nexus doctor --hooks
85
+ ```
86
+
87
+ Doctor reports whether each supported agent hook is:
88
+
89
+ - `current`
90
+ - `missing`
91
+ - `foreign`
92
+ - `wrong-agent`
93
+
94
+ Use `nexus hooks install --agent <handle>` to install or refresh a hook.
@@ -0,0 +1,135 @@
1
+ # Nexus Dynamic and Governed Loops Graphic Brief
2
+
3
+ ## Core Insight
4
+
5
+ Nexus is dynamic before approval and deterministic after approval.
6
+
7
+ The system already supports dynamism because agents can discover issues, propose work, shape tasks, and surface dependencies. That dynamism is easy to miss because the execution loop is intentionally governed and repeatable.
8
+
9
+ ## Graphic Goal
10
+
11
+ Create a clear visual that explains how Nexus handles both:
12
+
13
+ - dynamic discovery, planning, and proposal
14
+ - governed execution through approved queue work
15
+
16
+ The graphic should help users understand that Nexus is not a free-roaming autonomous agent system. It is a coordination workflow where agents can think and propose freely, but can only execute approved scoped work.
17
+
18
+ ## Suggested Diagram Structure
19
+
20
+ Show two connected loops with a visible approval boundary between them.
21
+
22
+ ### Loop 1: Dynamic Discovery Loop
23
+
24
+ Labels:
25
+
26
+ 1. Idea or observation
27
+ 2. Inspect context
28
+ 3. Find issue or opportunity
29
+ 4. Propose task
30
+ 5. Shape scope, files, dependencies, tradeoffs
31
+ 6. Wait for approval
32
+
33
+ Tone:
34
+
35
+ - exploratory
36
+ - generative
37
+ - allowed to be dynamic
38
+ - no file-changing execution unless separately approved and claimed
39
+
40
+ ### Boundary: Approval Gate
41
+
42
+ Main label:
43
+
44
+ > Dynamic before approval. Deterministic after approval.
45
+
46
+ Supporting labels:
47
+
48
+ - human review
49
+ - `Review: approved`
50
+ - `Approved by: human`
51
+ - `Auto-flow: yes`
52
+ - task contract is complete
53
+
54
+ This gate should visually separate proposal from execution.
55
+
56
+ ### Loop 2: Governed Execution Loop
57
+
58
+ Labels:
59
+
60
+ 1. Ready Queue
61
+ 2. `nexus next @agent`
62
+ 3. `nexus claim <path> @agent "intent"`
63
+ 4. Work inside claimed surface
64
+ 5. Validate
65
+ 6. `nexus release <path> "message"`
66
+ 7. Standup/report if useful
67
+ 8. Next safe task or Standby
68
+
69
+ Tone:
70
+
71
+ - deterministic
72
+ - repeatable
73
+ - file-scoped
74
+ - approval-bound
75
+ - safe for multi-agent concurrency
76
+
77
+ ## Key Message
78
+
79
+ Agents may discover and propose freely.
80
+ Agents may execute only approved scoped work.
81
+
82
+ ## What The Graphic Should Prevent
83
+
84
+ - Thinking Nexus is only a rigid task runner.
85
+ - Thinking Nexus lets agents freely invent and execute work.
86
+ - Treating `nexus next` as an ideation engine.
87
+ - Treating proposed work as executable work.
88
+ - Forgetting the approval boundary.
89
+
90
+ ## Possible Formats
91
+
92
+ - Mermaid draft for README
93
+ - FigJam/Figma system map
94
+ - Dashboard explainer panel
95
+ - README hero diagram
96
+ - Short docs page with the two-loop graphic and examples
97
+
98
+ ## Draft Mermaid Shape
99
+
100
+ ```mermaid
101
+ flowchart LR
102
+ subgraph Discovery["Dynamic Discovery Loop"]
103
+ A[Idea or observation] --> B[Inspect context]
104
+ B --> C[Find issue or opportunity]
105
+ C --> D[Propose task]
106
+ D --> E[Shape scope, files, dependencies, tradeoffs]
107
+ end
108
+
109
+ E --> Gate{Approval Gate}
110
+
111
+ Gate -->|Review approved + Auto-flow yes| R[Ready Queue]
112
+ Gate -->|Needs planning or approval| D
113
+
114
+ subgraph Execution["Governed Execution Loop"]
115
+ R --> N[nexus next @agent]
116
+ N --> CL[nexus claim path @agent intent]
117
+ CL --> W[Work inside claimed surface]
118
+ W --> V[Validate]
119
+ V --> REL[nexus release path message]
120
+ REL --> S[Standup or report]
121
+ S --> N
122
+ end
123
+
124
+ N -->|No safe task| Standby[Standby]
125
+ ```
126
+
127
+ ## Later Design Notes
128
+
129
+ - Make the discovery loop feel more fluid than the execution loop.
130
+ - Make the approval gate visually prominent.
131
+ - Use different colors for "propose" versus "execute", but keep the overall palette restrained.
132
+ - The primary caption should be short enough to remember:
133
+
134
+ > Dynamic before approval. Deterministic after approval.
135
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkobytes/nexus",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Multi-agent coordination CLI for coding agents sharing a local repository",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,6 +33,7 @@
33
33
  "files": [
34
34
  "bin/",
35
35
  "src/",
36
+ "docs/",
36
37
  "drills/",
37
38
  "skills/",
38
39
  "nexus-dashboard/",
@@ -7,12 +7,14 @@ description: Use in repos coordinated by the Nexus CLI, especially when _NEXUS_C
7
7
 
8
8
  Nexus CLI is the coordination engine. This skill is only the agent playbook.
9
9
 
10
+ If the user, repo, or hook says Nexus is active, treat this skill as mandatory workflow. It is not optional advice.
11
+
10
12
  ## Loop
11
13
 
12
14
  1. Run `nexus start`; set `NEXUS_AGENT` for your CLI, or pass `--agent @agy|@claude|@codex|@gemini`. Start is orientation only, not permission to edit.
13
15
  2. Read `_NEXUS_CONSTITUTION.md`.
14
16
  3. Read `USER.md` if present for local user preferences.
15
- 4. Read continuity and latest memory when present.
17
+ 4. Read continuity and latest memory at session start, `nexus start`, or resume.
16
18
  5. Read `_NEXUS_QUEUE.md` and `_NEXUS_STANDUP.md`.
17
19
  6. Choose user-assigned work or `nexus next @Agent`; do not free-roam into `Auto-flow: no`.
18
20
  7. Claim exact shared files before reading/editing:
@@ -22,14 +24,15 @@ Nexus CLI is the coordination engine. This skill is only the agent playbook.
22
24
  ```
23
25
 
24
26
  8. Treat claim output as current file state. Ignore cached file memory when contents matter.
25
- 9. Work only inside the claimed surface and run focused validation.
26
- 10. Release each claimed tracked file through Nexus as soon as it reaches a coherent checkpoint:
27
+ 9. If a hook blocks access because a path is unclaimed, stop and claim that exact path. Do not work around the hook with another command, cached content, or manual git operation.
28
+ 10. Work only inside the claimed surface and run focused validation.
29
+ 11. Release each claimed tracked file through Nexus as soon as it reaches a coherent checkpoint:
27
30
 
28
31
  ```bash
29
32
  nexus release <path> "short commit message"
30
33
  ```
31
34
 
32
- 11. Do not hold claims to bundle related work into a prettier feature commit. Nexus is agent-native and file-native: optimize for file availability, rollback safety, and agent throughput.
35
+ 12. Do not hold claims to bundle related work into a prettier feature commit. Nexus is agent-native and file-native: optimize for file availability, rollback safety, and agent throughput.
33
36
 
34
37
  ## Queue Items
35
38
 
@@ -62,6 +65,9 @@ When adding work to `_NEXUS_QUEUE.md`, keep tasks dashboard-parseable and immedi
62
65
  - Use `nexus doctor` for audit/repair, not as the normal startup command.
63
66
  - Use CLI/model names as lock handles: `@agy`, `@claude`, `@codex`, `@gemini`.
64
67
  - Agent-local continuity and memory files are claim-exempt unless the user says otherwise.
68
+ - Continuity is the compaction-safe session ledger; latest memory is required startup/resume context.
69
+ - Memory indexes use monthly folders and newest-first Markdown links with one-line outcomes.
70
+ - Shared generated protocol wording is sourced from `src/lib/protocolText.js`; update that first, then run doctor/init tests.
65
71
  - When using subagents or parallel workers, the lead agent owns the repo effects: claim the full path scope, pass boundaries down, re-read affected files, and mention delegated work in release or standup notes.
66
72
  - Avoid parallel `nexus release`.
67
73
  - Do not install packages younger than 14 days; if age is unknown, ask.
@@ -54,6 +54,7 @@ commands=(
54
54
  'db:Database backup and recovery'
55
55
  'drill:Inspect or run protocol drills'
56
56
  'soul:Manage local soul overlay in agent files'
57
+ 'install-skill:Install bundled Nexus skill into ~/.agents/skills'
57
58
  'help:Show command help'
58
59
  )
59
60
 
@@ -116,6 +117,9 @@ case $words[2] in
116
117
  soul)
117
118
  _arguments '--file[Overlay file path]:path:_files' '--status[Show status]' '--remove[Remove overlay]'
118
119
  ;;
120
+ install-skill)
121
+ _arguments '--target[Install target]:path:_files' '--force[Refresh existing installation]'
122
+ ;;
119
123
  start)
120
124
  _arguments '--agent[Agent handle]:agent:(@agy @claude @codex @gemini)'
121
125
  ;;