@moreih29/nexus-core 0.1.2 → 0.3.0

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.
Files changed (46) hide show
  1. package/README.md +3 -3
  2. package/agents/architect/body.md +7 -6
  3. package/agents/designer/body.md +3 -3
  4. package/agents/engineer/body.md +8 -8
  5. package/agents/postdoc/body.md +4 -4
  6. package/agents/researcher/body.md +5 -5
  7. package/agents/reviewer/body.md +2 -2
  8. package/agents/strategist/body.md +4 -4
  9. package/agents/tester/body.md +2 -2
  10. package/agents/writer/body.md +1 -1
  11. package/conformance/README.md +125 -0
  12. package/conformance/scenarios/full-plan-cycle.json +132 -0
  13. package/conformance/scenarios/task-deps-ordering.json +83 -0
  14. package/conformance/schema/fixture.schema.json +224 -0
  15. package/conformance/state-schemas/agent-tracker.schema.json +58 -0
  16. package/conformance/state-schemas/history.schema.json +124 -0
  17. package/conformance/state-schemas/plan.schema.json +72 -0
  18. package/conformance/state-schemas/runtime.schema.json +25 -0
  19. package/conformance/state-schemas/tasks.schema.json +93 -0
  20. package/conformance/tools/plan-decide.json +70 -0
  21. package/conformance/tools/plan-start.json +67 -0
  22. package/conformance/tools/task-add.json +73 -0
  23. package/conformance/tools/task-close.json +98 -0
  24. package/conformance/tools/task-list.json +157 -0
  25. package/conformance/tools/task-update.json +139 -0
  26. package/docs/behavioral-contracts.md +145 -0
  27. package/docs/consumer-implementation-guide.md +844 -0
  28. package/docs/nexus-layout.md +234 -0
  29. package/docs/nexus-state-overview.md +185 -0
  30. package/docs/nexus-tools-contract.md +427 -0
  31. package/manifest.json +90 -82
  32. package/package.json +5 -1
  33. package/schema/common.schema.json +0 -4
  34. package/schema/skill.schema.json +16 -1
  35. package/schema/vocabulary.schema.json +14 -9
  36. package/skills/nx-init/body.md +14 -17
  37. package/skills/nx-init/meta.yml +3 -0
  38. package/skills/nx-plan/body.md +17 -14
  39. package/skills/nx-plan/meta.yml +3 -0
  40. package/skills/nx-run/body.md +4 -4
  41. package/skills/nx-run/meta.yml +3 -0
  42. package/skills/nx-sync/body.md +5 -5
  43. package/skills/nx-sync/meta.yml +1 -0
  44. package/vocabulary/capabilities.yml +58 -25
  45. package/skills/nx-setup/body.md +0 -196
  46. package/skills/nx-setup/meta.yml +0 -4
@@ -8,7 +8,7 @@ Scans the current project state and synchronizes .nexus/context/ design document
8
8
  - NEVER modify source code — this skill updates documentation only
9
9
  - NEVER guess information that cannot be confirmed from sources — mark as "needs verification" instead
10
10
  - MUST preserve existing content structure — update sections, don't rewrite entire files unnecessarily
11
- - NEVER use deprecated MCP knowledge tools — use Read and Write native tools only
11
+ - NEVER use deprecated MCP knowledge tools — use the harness's file-reading and file-creation primitives only
12
12
 
13
13
  ## Guidelines
14
14
 
@@ -31,7 +31,7 @@ Collect information from all available sources:
31
31
 
32
32
  ### Step 2: Read Current Context
33
33
 
34
- Read all files in `.nexus/context/` using the Read tool:
34
+ Read all files in `.nexus/context/` using the harness's file-reading primitive:
35
35
 
36
36
  - List files: `ls .nexus/context/`
37
37
  - Read each file to understand current documented state
@@ -45,13 +45,13 @@ Spawn Writer agent to update affected context documents:
45
45
 
46
46
  ```
47
47
  Agent({ subagent_type: "claude-nexus:writer", name: "writer-sync-context",
48
- prompt: "Update .nexus/context/ documents based on the following changes. Read current files with the Read tool, then write updates with the Write tool. Changes: {change_manifest}" })
48
+ prompt: "Update .nexus/context/ documents based on the following changes. Read current files with the harness's file-reading primitive, then write updates with the harness's file-creation primitive. Changes: {change_manifest}" })
49
49
  ```
50
50
 
51
51
  The Writer agent:
52
- - Reads each relevant context file with the Read tool
52
+ - Reads each relevant context file with the harness's file-reading primitive
53
53
  - Applies targeted updates — changes only the sections that are stale
54
- - Writes the updated file back with the Write tool
54
+ - Writes the updated file back with the harness's file-creation primitive
55
55
  - Does not rewrite files that are already accurate
56
56
 
57
57
  ### Step 4: Report
@@ -1,6 +1,7 @@
1
1
  name: nx-sync
2
2
  description: Context knowledge synchronization — scans project state and updates
3
3
  .nexus/context/ design documents
4
+ summary: "Context knowledge synchronization"
4
5
  triggers:
5
6
  - sync
6
7
  id: nx-sync
@@ -1,32 +1,65 @@
1
- # Capabilities restrict an agent's access to harness-provided tools.
2
- # NOT constraints on nexus-core's own scripts/ or tooling.
1
+ # Harness-neutral capability definitions.
2
+ # Each entry describes WHAT is denied in semantic terms.
3
+ # Consumers (claude-nexus, opencode-nexus, nexus-code) maintain their own
4
+ # local map from these ids/classes to concrete tool names in their own repo.
5
+ # nexus-core does not and must not know those tool names.
3
6
 
4
7
  capabilities:
5
8
  - id: no_file_edit
6
- description: "Agent cannot create or modify files in the user's workspace"
7
- harness_mapping:
8
- claude_code:
9
- - Edit
10
- - Write
11
- - NotebookEdit
12
- opencode:
13
- - edit
14
- - write
15
- - patch
16
- - multiedit
9
+ description: "Agent cannot create, modify, or delete files in the user's workspace."
10
+ intent: workspace_write_denial
11
+ blocks_semantic_classes:
12
+ - file_creation
13
+ - file_modification
14
+ - file_deletion
15
+ - partial_file_edit
16
+ - structured_document_edit
17
+ prose_guidance: |
18
+ Block any tool whose primary effect is to alter content at a workspace
19
+ file path. This includes: creating new files at arbitrary paths, rewriting
20
+ whole file contents, applying partial edits (diffs, patches, find-replace,
21
+ multi-edit batches), deleting or truncating files, and cell-level edits in
22
+ structured documents such as notebooks.
23
+ Read-only operations are NOT blocked: reading file contents, querying
24
+ metadata, listing directories, and running code-intelligence queries that
25
+ do not mutate files.
17
26
 
18
27
  - id: no_task_create
19
- description: "Agent cannot create new tasks in the Nexus task pipeline"
20
- harness_mapping:
21
- claude_code:
22
- - mcp__plugin_claude-nexus_nx__nx_task_add
23
- opencode:
24
- - nx_task_add
28
+ description: "Agent cannot create new tasks in the Nexus task pipeline."
29
+ intent: task_pipeline_append_denial
30
+ blocks_semantic_classes:
31
+ - nexus_task_creation
32
+ prose_guidance: |
33
+ Block any tool that appends a new task to the Nexus task pipeline (the
34
+ mechanism by which Lead-owned work is enqueued for execution). Tools that
35
+ read, list, or query existing tasks are NOT blocked. Tools that modify
36
+ existing task state belong to a separate capability (no_task_update) and
37
+ are not governed here.
25
38
 
26
39
  - id: no_task_update
27
- description: "Agent cannot update the state of existing Nexus tasks"
28
- harness_mapping:
29
- claude_code:
30
- - mcp__plugin_claude-nexus_nx__nx_task_update
31
- opencode:
32
- - nx_task_update
40
+ description: "Agent cannot update the state of existing Nexus tasks."
41
+ intent: task_pipeline_mutate_denial
42
+ blocks_semantic_classes:
43
+ - nexus_task_state_transition
44
+ - nexus_task_metadata_modification
45
+ prose_guidance: |
46
+ Block any tool that mutates an existing Nexus task: changing its status,
47
+ editing its description, reassigning ownership, closing it, or modifying
48
+ any field on its record. Tools that read, list, or query tasks are NOT
49
+ blocked. Creation of new tasks is governed by no_task_create, not here.
50
+
51
+ - id: no_shell_exec
52
+ description: "Agent cannot execute arbitrary shell commands or spawn subprocesses."
53
+ intent: shell_execution_denial
54
+ blocks_semantic_classes:
55
+ - shell_command_exec
56
+ - subprocess_spawn
57
+ - interactive_shell_session
58
+ prose_guidance: |
59
+ Block any tool whose primary effect is to run a command-line invocation,
60
+ shell script, or spawn a subprocess on the user's machine. This includes
61
+ general-purpose shell runners, background process managers, shell output
62
+ readers, and shell-session kill operations. Tools that read files, query
63
+ metadata, or call specialized non-shell APIs (HTTP, language-server
64
+ queries, sandboxed code evaluators that do not spawn user-machine
65
+ processes) are NOT blocked.
@@ -1,196 +0,0 @@
1
- ## Role
2
-
3
- Interactive project setup wizard — configure Nexus for a new project with minimal token cost. Every step is a concrete choice via `AskUserQuestion`, with no open-ended exploration.
4
-
5
- ## Constraints
6
-
7
- - NEVER accept free-text input — every step must use `AskUserQuestion` with explicit options.
8
- - NEVER skip the "Skip" option — all steps are optional.
9
- - NEVER modify files outside the selected scope without explicit user confirmation.
10
- - NEVER overwrite an existing `statusLine` field in settings.json without explicit user confirmation.
11
-
12
- ## Guidelines
13
-
14
- ## Trigger
15
- - Direct invocation: `/claude-nexus:nx-setup`
16
-
17
- ---
18
-
19
- ## Steps
20
-
21
- ### Step 1: Scope Selection
22
-
23
- ```
24
- AskUserQuestion({
25
- questions: [{
26
- question: "Where should the Nexus configuration be applied?",
27
- header: "Scope",
28
- multiSelect: false,
29
- options: [
30
- { label: "User (Global)", description: "Apply to all projects (~/.claude/CLAUDE.md, ~/.claude/settings.json statusline)" },
31
- { label: "Project", description: "Apply to this project only (CLAUDE.md, .claude/settings.local.json)" }
32
- ]
33
- }]
34
- })
35
- ```
36
-
37
- All file write paths for subsequent steps are determined by this selection:
38
- - User: `~/.claude/CLAUDE.md`, `~/.claude/settings.json` (statusline wrapper)
39
- - Project: `./CLAUDE.md`, `./.claude/settings.local.json`
40
-
41
- ### Step 2: Statusline
42
-
43
- ```
44
- AskUserQuestion({
45
- questions: [{
46
- question: "Enable the Nexus statusline? (model, branch, context usage, rate limits)",
47
- header: "Statusline",
48
- multiSelect: false,
49
- options: [
50
- { label: "Enable (Recommended)", description: "2 lines: model+branch+git, context+usage meters" },
51
- { label: "Skip", description: "Skip statusline configuration" }
52
- ]
53
- }]
54
- })
55
- ```
56
-
57
- **Create wrapper script** (for Enable, run via Bash tool):
58
- ```bash
59
- mkdir -p ~/.claude/hooks
60
- cat > ~/.claude/hooks/nexus-statusline.sh << 'EOF'
61
- #!/bin/bash
62
- SCRIPT=$(ls -1d "$HOME/.claude/plugins/cache/nexus/claude-nexus"/*/scripts/statusline.cjs 2>/dev/null | sort -V | tail -1)
63
- [ -n "$SCRIPT" ] && exec node "$SCRIPT"
64
- EOF
65
- chmod +x ~/.claude/hooks/nexus-statusline.sh
66
- ```
67
-
68
- **On selection, depending on scope:**
69
-
70
- **(1) User scope:**
71
- - Create wrapper script (run step above)
72
- - If `statusLine` field is **absent** in `~/.claude/settings.json`: add statusLine setting directly:
73
- ```json
74
- { "statusLine": { "type": "command", "command": "bash $HOME/.claude/hooks/nexus-statusline.sh" } }
75
- ```
76
- - If `statusLine` field **already exists** in `~/.claude/settings.json`: create wrapper only, do not modify settings.json — ask user to confirm replacement (see "Statusline coexistence handling" below)
77
-
78
- **(2) Project scope:**
79
- - Create wrapper script (run step above)
80
- - If `statusLine` field is **absent** in `.claude/settings.local.json`: add statusLine setting directly:
81
- ```json
82
- { "statusLine": { "type": "command", "command": "bash $HOME/.claude/hooks/nexus-statusline.sh" } }
83
- ```
84
- - If `statusLine` field **already exists** in `.claude/settings.local.json`: create wrapper only, do not modify settings.local.json — ask user to confirm replacement (see "Statusline coexistence handling" below)
85
- **(3) Skip:**
86
- - Do not create wrapper or modify settings.json.
87
-
88
- **Statusline coexistence handling:**
89
-
90
- Run only if settings.json modification was deferred above (i.e., wrapper was created but existing statusLine was detected).
91
- If statusLine settings were already applied above, skip this sub-step.
92
-
93
- Specifically, treat an existing statusline setting as detected if any of the following are true:
94
- - `~/.claude/hooks/statusline.sh` file exists
95
- - Or the scope-appropriate settings.json (`~/.claude/settings.json` or `.claude/settings.local.json`) already has a `statusLine` field
96
-
97
- If detected:
98
-
99
- ```
100
- AskUserQuestion({
101
- questions: [{
102
- question: "An existing statusline configuration was detected. Replace it with the Nexus statusline?",
103
- header: "Statusline",
104
- multiSelect: false,
105
- options: [
106
- { label: "Replace (Recommended)", description: "Replace with Nexus statusline (wrapper script configuration)" },
107
- { label: "Keep Existing", description: "Keep existing statusline. Nexus wrapper is created but settings.json is not modified." }
108
- ]
109
- }]
110
- })
111
- ```
112
-
113
- - "Replace (Recommended)": replace the `statusLine` in the scope-appropriate settings.json with the Nexus wrapper (wrapper script already created above)
114
- - "Keep Existing": keep the existing `statusLine` in settings.json (wrapper script already created above — user can switch manually later)
115
-
116
- If no existing statusline configuration is detected, skip this sub-step.
117
-
118
- ### Step 3: Recommended Plugin
119
-
120
- Check if `context7@claude-plugins-official` is in `enabledPlugins` (global or project settings.json).
121
-
122
- **Already installed:**
123
-
124
- Notify and skip:
125
- ```
126
- "Recommended plugin already installed: context7 ✓"
127
- ```
128
-
129
- **Not installed:**
130
-
131
- ```
132
- AskUserQuestion({
133
- questions: [{
134
- question: "Install the context7 plugin? It enables agents to look up library docs in real time.",
135
- header: "Plugin",
136
- multiSelect: false,
137
- options: [
138
- { label: "Install (Recommended)", description: "context7 — real-time library documentation lookup (Upstash Context7)" },
139
- { label: "Skip", description: "Skip recommended plugin installation" }
140
- ]
141
- }]
142
- })
143
- ```
144
-
145
- **If "Install":**
146
- Add to `enabledPlugins` in the scope-appropriate settings.json (`~/.claude/settings.json` or `.claude/settings.local.json`):
147
- ```json
148
- {
149
- "context7@claude-plugins-official": true
150
- }
151
- ```
152
- Claude Code will automatically install the plugin at the start of the next session.
153
-
154
- **If "Skip":** proceed to the next step.
155
-
156
- Note: Once added to `enabledPlugins`, Claude Code automatically installs the plugin at the start of the next session.
157
-
158
- ### Step 4: Knowledge Init
159
-
160
- ```
161
- AskUserQuestion({
162
- questions: [{
163
- question: "Auto-generate project core knowledge?",
164
- header: "Init",
165
- multiSelect: false,
166
- options: [
167
- { label: "Yes (Recommended)", description: "Analyze existing docs (README, CLAUDE.md, etc.) to generate knowledge files in .nexus/memory/ and .nexus/context/" },
168
- { label: "Skip", description: "Run manually later with /claude-nexus:nx-init" }
169
- ]
170
- }]
171
- })
172
- ```
173
-
174
- If "Yes": invoke `Skill({ skill: "claude-nexus:nx-init" })`.
175
- If "Skip": proceed to next step.
176
-
177
- ### Step 5: Complete
178
-
179
- Output a setup completion message:
180
- - Summary of applied settings
181
- - Brief introduction to available skills/agents
182
- - "To get started, describe a task, or use [plan] for planning, [run] for execution, [rule] for saving rules"
183
-
184
- ---
185
-
186
- ## Key Principles
187
-
188
- 1. **Every step uses AskUserQuestion** — no free-text input
189
- 2. **Minimize tokens** — limit each step to concrete choices to prevent unnecessary exploration
190
- 3. **Always provide a Skip option** — nothing is forced
191
- 4. **Extensible structure** — includes recommended plugin step, expandable to additional categories in the future
192
-
193
- ## State Management
194
-
195
- Setup operates via sequential AskUserQuestion calls with no state file.
196
- Configuration results are written to the scope-appropriate settings file at each step.
@@ -1,4 +0,0 @@
1
- name: nx-setup
2
- description: Interactive project setup wizard for Nexus configuration.
3
- manual_only: true
4
- id: nx-setup