@ornexus/neocortex 4.60.81 → 4.61.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 (52) hide show
  1. package/dist/release-source.json +1 -1
  2. package/install.ps1 +33 -1
  3. package/install.sh +35 -1
  4. package/package.json +2 -2
  5. package/packages/client/dist/adapters/platform-detector.d.ts +1 -1
  6. package/packages/client/dist/adapters/platform-detector.js +6 -0
  7. package/packages/client/dist/cli.js +7 -0
  8. package/packages/client/dist/commands/invoke.d.ts +15 -8
  9. package/packages/client/dist/commands/invoke.js +69 -0
  10. package/packages/client/dist/commands/story-checkpoint.d.ts +2 -1
  11. package/packages/client/dist/commands/story-checkpoint.js +34 -2
  12. package/packages/client/dist/commands/story-worktree.d.ts +46 -0
  13. package/packages/client/dist/commands/story-worktree.js +258 -0
  14. package/packages/client/dist/config.js +1 -0
  15. package/packages/client/dist/git/direct-yolo-checkpoint.d.ts +46 -0
  16. package/packages/client/dist/git/direct-yolo-checkpoint.js +137 -1
  17. package/packages/client/dist/git/git-lifecycle-store.d.ts +82 -0
  18. package/packages/client/dist/git/git-lifecycle-store.js +310 -4
  19. package/packages/client/dist/git/story-worktree-cleanup.d.ts +226 -0
  20. package/packages/client/dist/git/story-worktree-cleanup.js +1058 -0
  21. package/packages/client/dist/git/story-worktree-integration.d.ts +91 -0
  22. package/packages/client/dist/git/story-worktree-integration.js +603 -0
  23. package/packages/client/dist/git/story-worktree-manager.d.ts +205 -0
  24. package/packages/client/dist/git/story-worktree-manager.js +843 -0
  25. package/packages/client/dist/git/story-worktree-paths.d.ts +65 -0
  26. package/packages/client/dist/git/story-worktree-paths.js +150 -0
  27. package/packages/client/dist/policy/subagent-approval-policy.js +3 -1
  28. package/packages/client/dist/runner/headless/continuous-story-workspace.d.ts +49 -1
  29. package/packages/client/dist/runner/headless/continuous-story-workspace.js +175 -27
  30. package/packages/client/dist/runner/headless/run-yoloop.d.ts +39 -0
  31. package/packages/client/dist/runner/headless/run-yoloop.js +71 -0
  32. package/packages/client/dist/runner-cli.js +0 -0
  33. package/packages/shared/dist/yoloop/epic-terminal-git.js +27 -3
  34. package/targets-stubs/antigravity/gemini.md +1 -1
  35. package/targets-stubs/antigravity/neocortex.md +21 -0
  36. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  37. package/targets-stubs/claude-code/README.md +17 -0
  38. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  39. package/targets-stubs/claude-code/neocortex-root.md +57 -49
  40. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  41. package/targets-stubs/claude-code/neocortex.md +28 -25
  42. package/targets-stubs/codex/AGENTS.md +31 -30
  43. package/targets-stubs/codex/neocortex.toml +10 -0
  44. package/targets-stubs/cursor/agent.md +13 -2
  45. package/targets-stubs/deepseek-harness/SKILL.md +13 -0
  46. package/targets-stubs/gemini-cli/agent.md +23 -2
  47. package/targets-stubs/grok/SKILL.md +21 -0
  48. package/targets-stubs/kimi/neocortex.md +21 -0
  49. package/targets-stubs/openclaw/SKILL.md +21 -0
  50. package/targets-stubs/opencode/neocortex-root.md +19 -15
  51. package/targets-stubs/opencode/neocortex.md +10 -0
  52. package/targets-stubs/vscode/neocortex.agent.md +13 -2
@@ -20,6 +20,8 @@ import { createAnchoredContinuousStoryCommandRunner, createBranchlessContinuousS
20
20
  import { P205_RELEASE_GATE_BUDGETS, } from '../../../../shared/dist/yoloop/epic-terminal-git.js';
21
21
  import { executeEpicGitReconciliation, executeEpicTerminalGit } from './epic-terminal-git-runner.js';
22
22
  import { createCliEpicTerminalGitAdapter } from './epic-terminal-git-cli-adapter.js';
23
+ import { installStoryWorktreeSignalSweep, sweepStoryWorktreeOrphans } from '../../git/story-worktree-cleanup.js';
24
+ import { integrateStoryWorktreesInOrder, syncReleasedDependents, } from '../../git/story-worktree-integration.js';
23
25
  import { acquireGitLifecyclePhysicalIntegrationLock, releaseGitLifecyclePhysicalIntegrationLock, } from '../../git/git-lifecycle-store.js';
24
26
  import { normalizeContinuousWriteRef } from '../../../../shared/dist/yoloop/wave-decision-receipt.js';
25
27
  import { parseReleaseBlockedResult, } from '../../../../shared/dist/yoloop/release-blocked.js';
@@ -95,6 +97,49 @@ function hasDelegatedPromptIsolationViolation(prompt) {
95
97
  SHELL_FRAGMENT_PATTERN.test(prompt) ||
96
98
  UNSAFE_VALUE_PATTERN.test(prompt);
97
99
  }
100
+ const YOLOOP_V4_STORY_ID = /^P[1-9][0-9]*(?:\.[0-9]+)+$/;
101
+ /**
102
+ * P225.07-ADR-8: validate the v4 integration fields (root-owned, one
103
+ * integrator) and integrate in `integrationOrder`, then sync released
104
+ * dependents. Phase dispatch of v4 children is wired by P225.09.
105
+ */
106
+ export async function executeYoloopV4IntegrationOrder(plan, options) {
107
+ const record = isRecord(plan) ? plan : undefined;
108
+ const policy = record && isRecord(record.isolationPolicy) ? record.isolationPolicy : undefined;
109
+ const storyIds = record && Array.isArray(record.storyIds) ? record.storyIds : [];
110
+ const order = record && Array.isArray(record.integrationOrder) ? record.integrationOrder : [];
111
+ const validStories = storyIds.length > 0 && new Set(storyIds).size === storyIds.length
112
+ && storyIds.every((storyId) => typeof storyId === 'string' && YOLOOP_V4_STORY_ID.test(storyId));
113
+ if (!record || record.version !== 4 || record.mode !== 'two_phase_worktree_dag'
114
+ || record.authorization !== 'server_authorized'
115
+ || !policy || policy.integrationOwner !== 'root_agent' || policy.maxIntegrationConcurrency !== 1
116
+ || policy.rootOwnsLoop !== true || policy.allowOuterYoloopInChild !== false
117
+ || !validStories || order.length === 0 || new Set(order).size !== order.length
118
+ || order.some((storyId) => typeof storyId !== 'string' || !storyIds.includes(storyId))
119
+ || options.readyStoryIds.some((storyId) => !storyIds.includes(storyId))) {
120
+ return { ok: false, reasonCode: 'plan-v4-integration-order-invalid', synced: [], publicSafe: true };
121
+ }
122
+ const integrateInOrder = options.integrateInOrder ?? integrateStoryWorktreesInOrder;
123
+ const integration = await integrateInOrder({
124
+ projectRoot: options.projectRoot,
125
+ integrationOrder: order,
126
+ readyStoryIds: options.readyStoryIds,
127
+ ...(options.push !== undefined ? { push: options.push } : {}),
128
+ ...(options.remote ? { remote: options.remote } : {}),
129
+ });
130
+ const directives = (options.releaseDirectives ?? []).filter((directive) => isRecord(directive) && typeof directive.storyId === 'string' && storyIds.includes(directive.storyId));
131
+ const sync = options.syncDependents ?? syncReleasedDependents;
132
+ const synced = directives.length > 0 ? await sync({ projectRoot: options.projectRoot, directives }) : [];
133
+ const syncFailure = synced.find((item) => !item.ok);
134
+ // Waiting and conflict-reopened are scheduler signals (the server reopens C14), not failures.
135
+ const blocking = integration.reasonCode && integration.reasonCode !== 'story-worktree-integration-waiting'
136
+ && integration.reasonCode !== 'integration-conflict-reopened' ? integration.reasonCode : undefined;
137
+ return {
138
+ ok: !blocking && !syncFailure,
139
+ ...(blocking ? { reasonCode: blocking } : syncFailure?.reasonCode ? { reasonCode: syncFailure.reasonCode } : {}),
140
+ integration, synced, publicSafe: true,
141
+ };
142
+ }
98
143
  export function isCanonicalDelegatedStoryPrompt(prompt) {
99
144
  return !hasDelegatedPromptIsolationViolation(prompt) && CHILD_PROMPT_PATTERN.test(prompt);
100
145
  }
@@ -221,6 +266,32 @@ export async function runYoloopExecutionPhase(options) {
221
266
  const localConcurrencyCap = boundedInteger(options.localConcurrencyCap ?? resolveDefaultHeadlessYoloopLocalConcurrencyCap(), 1, MAX_HEADLESS_YOLOOP_LOCAL_CONCURRENCY_CAP);
222
267
  const reasonCodes = [];
223
268
  const receipts = [];
269
+ const disposeSignalSweep = options.storyWorktreeSignalSweep === true
270
+ ? installStoryWorktreeSignalSweep(options.projectRoot)
271
+ : undefined;
272
+ try {
273
+ // P225.06: sweep codes are appended to (never replace) the phase summary codes.
274
+ const sweepReasonCodes = [];
275
+ if (options.storyWorktreeSweeper !== false) {
276
+ const sweeper = options.storyWorktreeSweeper ?? sweepStoryWorktreeOrphans;
277
+ try {
278
+ sweepReasonCodes.push(...(await sweeper(options.projectRoot)).reasonCodes);
279
+ }
280
+ catch {
281
+ sweepReasonCodes.push('story-worktree-sweep-failed');
282
+ }
283
+ }
284
+ const summary = await runYoloopExecutionPhaseInner(options, {
285
+ registry, limit, leaseMs, staleLeaseAfterMs, maxAttempts, localConcurrencyCap, reasonCodes, receipts,
286
+ });
287
+ return sweepReasonCodes.length === 0 ? summary : { ...summary, reasonCodes: unique([...summary.reasonCodes, ...sweepReasonCodes]) };
288
+ }
289
+ finally {
290
+ disposeSignalSweep?.();
291
+ }
292
+ }
293
+ async function runYoloopExecutionPhaseInner(options, context) {
294
+ const { registry, limit, leaseMs, staleLeaseAfterMs, maxAttempts, localConcurrencyCap, reasonCodes, receipts } = context;
224
295
  const nowIso = options.now();
225
296
  const enqueueResult = enqueueRunYoloopExecutionDirectives({
226
297
  store: options.store,
File without changes
@@ -47,6 +47,10 @@ export const EPIC_TERMINAL_GIT_REASON_CODES = Object.freeze({
47
47
  ORIGIN_BINDING_REQUIRED: 'epic-origin-binding-required',
48
48
  PROVIDER_TRUTH_UNKNOWN: 'git-resource-provider-truth-unknown',
49
49
  WORKTREE_ACTIVE: 'git-resource-worktree-active',
50
+ /** P225.06: a worktree without journal entry or ownership marker. */
51
+ MANUAL_WORKTREE_PRESERVED: 'manual-worktree-preserved',
52
+ /** P225.06: a managed temporary worktree whose cleanup is not yet proven. */
53
+ MANAGED_WORKTREE_CLEANUP_REQUIRED: 'managed-worktree-cleanup-required',
50
54
  RESOURCE_RACED: 'git-resource-expected-oid-raced',
51
55
  REMOTE_DELETE_CAS_UNAVAILABLE: 'git-resource-remote-delete-cas-unavailable',
52
56
  ORIGIN_CAPTURE_WINDOW_MISSED: 'epic-origin-binding-capture-window-missed',
@@ -153,6 +157,15 @@ export function validateEpicHeadReconciliationReceipt(value, expected) {
153
157
  && now - revalidatedAt <= P205_RELEASE_GATE_BUDGETS.aggregateValidityMs
154
158
  && revalidatedAt - now <= P205_RELEASE_GATE_BUDGETS.cancellationGraceMs;
155
159
  }
160
+ /**
161
+ * P225.06 ownership of a registered worktree: managed only with both the
162
+ * journal entry and the nonce marker; anything else is manual and preserved.
163
+ */
164
+ export function classifyStoryWorktreeOwnership(evidence) {
165
+ return evidence.journalEntry === true && evidence.markerProven === true
166
+ ? Object.freeze({ ownership: 'managed_temporary' })
167
+ : Object.freeze({ ownership: 'manual', reasonCode: EPIC_TERMINAL_GIT_REASON_CODES.MANUAL_WORKTREE_PRESERVED });
168
+ }
156
169
  export function validateEpicTerminalGitDirective(directive, actual) {
157
170
  const reasons = [];
158
171
  if (!nonEmpty(directive.originBranch))
@@ -270,16 +283,27 @@ export function classifyGitReconciliationCandidate(candidate) {
270
283
  if (candidate.lifecycle === 'already_absent' && candidate.providerVerified) {
271
284
  return Object.freeze({ schemaVersion: 1, resourceId: candidate.resourceId, action: 'no_op', managed, reasonCodes: [EPIC_TERMINAL_GIT_REASON_CODES.ALREADY_RECONCILED], evidence, publicSafe: true });
272
285
  }
273
- if (!managed)
274
- return preserve(EPIC_TERMINAL_GIT_REASON_CODES.OWNERSHIP_UNPROVEN);
286
+ const manualWorktree = candidate.worktreeActive && candidate.worktreeOwnership === 'manual';
287
+ if (!managed) {
288
+ return manualWorktree
289
+ ? preserve(EPIC_TERMINAL_GIT_REASON_CODES.OWNERSHIP_UNPROVEN, EPIC_TERMINAL_GIT_REASON_CODES.MANUAL_WORKTREE_PRESERVED)
290
+ : preserve(EPIC_TERMINAL_GIT_REASON_CODES.OWNERSHIP_UNPROVEN);
291
+ }
275
292
  if (!candidate.providerVerified)
276
293
  return preserve(EPIC_TERMINAL_GIT_REASON_CODES.PROVIDER_TRUTH_UNKNOWN);
277
294
  if (candidate.origin)
278
295
  return preserve(EPIC_TERMINAL_GIT_REASON_CODES.RESOURCE_ORIGIN);
279
296
  if (candidate.current)
280
297
  return preserve(EPIC_TERMINAL_GIT_REASON_CODES.RESOURCE_CURRENT);
281
- if (candidate.worktreeActive)
298
+ if (candidate.worktreeActive) {
299
+ if (manualWorktree) {
300
+ return preserve(EPIC_TERMINAL_GIT_REASON_CODES.WORKTREE_ACTIVE, EPIC_TERMINAL_GIT_REASON_CODES.MANUAL_WORKTREE_PRESERVED);
301
+ }
302
+ if (candidate.worktreeOwnership === 'managed_temporary') {
303
+ return preserve(EPIC_TERMINAL_GIT_REASON_CODES.WORKTREE_ACTIVE, EPIC_TERMINAL_GIT_REASON_CODES.MANAGED_WORKTREE_CLEANUP_REQUIRED);
304
+ }
282
305
  return preserve(EPIC_TERMINAL_GIT_REASON_CODES.WORKTREE_ACTIVE);
306
+ }
283
307
  if (candidate.protected)
284
308
  return preserve(EPIC_TERMINAL_GIT_REASON_CODES.RESOURCE_PROTECTED);
285
309
  if (candidate.lifecycle === 'active')
@@ -1,4 +1,4 @@
1
- # 🧠 Neocortex v4.60.81 | OrNexus Team
1
+ # 🧠 Neocortex v4.61.0 | OrNexus Team
2
2
 
3
3
  This project uses Neocortex, a Development Orchestrator.
4
4
 
@@ -100,3 +100,24 @@ verification when a terminal-complete response carries the terminal directive.
100
100
  Remote branch deletion is
101
101
  preserved with `git-resource-remote-delete-cas-unavailable` when no OID-bound
102
102
  provider primitive exists; local refs and PRs still reconcile when fully proven.
103
+
104
+ ### Story worktree plans (v4)
105
+
106
+ For a `version: 4`, `mode: two_phase_worktree_dag`,
107
+ `workspaceMechanism: client_managed_worktree` plan: one child per phase story
108
+ in a single turn, server prompt (`story-worktree-phase-1`), at most the phase
109
+ `maxConcurrency`. Each child runs `neocortex-client story-worktree create` with
110
+ server IDs/SHAs and a new `--path-file`, then its phase `*yolo` with
111
+ `--project-root` at that worktree; `story-worktree-phase-2` reuses the lease. I
112
+ re-invoke `*yoloop` after each phase and alone integrate; cleanup is
113
+ `neocortex-client`. Children never receive `*yoloop`.
114
+
115
+ ### Story worktree phase prompts (v4)
116
+
117
+ `story-worktree-phase-1` with `workspaceMechanism: client_managed_worktree`: at
118
+ setup I run `neocortex-client story-worktree create` with `--epic`, `--story`,
119
+ `--dispatch`, `--base-sha` and `--graph-revision` from server output, never
120
+ invented, plus a new `--path-file`; then I invoke with `--project-root` set to
121
+ the worktree path in that file. `story-worktree-phase-2`: I reuse that lease
122
+ (`neocortex-client story-worktree status`). Any refusal reason code stops me. I
123
+ never commit to or check out `epic/<ID>`; cleanup is `neocortex-client`.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.60.81 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.61.0 | OrNexus Team"
4
4
  ---
5
5
 
6
6
  <!--
@@ -17,4 +17,21 @@ neocortex activate YOUR-LICENSE-KEY # Get yours at https://neocortex.sh/portal/
17
17
  neocortex install --local
18
18
  ```
19
19
 
20
+ ## Story worktree capability (v4 plans)
21
+
22
+ - Claude Code uses the native subagent worktree mechanism
23
+ (`native_subagent_worktree`): the root dispatches phase-1 children with
24
+ `isolation: "worktree"` only when the server plan is v4 with that mechanism;
25
+ phase-2 children run without `isolation` in the already adopted worktree.
26
+ - Each child registers its worktree with `neocortex-client story-worktree adopt`;
27
+ adopt fails closed on a base mismatch or a dirty checkout. Set
28
+ `worktree.baseRef: "head"` in Claude Code settings so native worktrees start
29
+ from the epic checkout instead of the remote default branch.
30
+ - Cleanup is always `neocortex-client`; the harness branch is preserved. A
31
+ worktree the harness removed on its own (no changes) is reconciled by the
32
+ client orphan recovery (`neocortex-client story-worktree recover`).
33
+ - Smoke status: `unvalidated` until the versioned harness smoke is recorded.
34
+ Without it, or with the feature flag off, the server keeps the current
35
+ Parallel Delegation Contract (rollback path).
36
+
20
37
  For more information, visit: https://neocortex.sh
@@ -4,7 +4,7 @@ agent:
4
4
  name: 'Neocortex Root Agent'
5
5
  title: 'Development Orchestrator (Root)'
6
6
  icon: '>'
7
- version: '4.60.81'
7
+ version: '4.61.0'
8
8
  architecture: 'thin-client'
9
9
  module: stand-alone
10
10
  hasSidecar: false
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex-root
3
- description: "🧠 Neocortex Root Agent v4.60.81 | OrNexus Team"
3
+ description: "🧠 Neocortex Root Agent v4.61.0 | OrNexus Team"
4
4
  model: opus
5
5
  color: blue
6
6
  tools:
@@ -96,10 +96,9 @@ and `metadata.yoloopAborted === false`.
96
96
 
97
97
  ## Server-Side Guidance Boundary
98
98
 
99
- Neocortex may return curated design-intelligence guidance for UI stories. Treat
100
- that guidance as server output from `neocortex-client invoke`; do not install,
101
- fetch, or run upstream skills locally, and do not paste private prompt bodies or
102
- protected source material into this file.
99
+ Curated design-intelligence guidance for UI stories is server output from
100
+ `neocortex-client invoke`; do not install, fetch or run upstream skills locally,
101
+ nor paste private prompt bodies or protected source material here.
103
102
 
104
103
  ## Banner
105
104
 
@@ -109,7 +108,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
109
108
  ┌────────────────────────────────────────────────────────────┐
110
109
  │ │
111
110
  │ ####### N E O C O R T E X │
112
- │ ### ######## v4.60.81 │
111
+ │ ### ######## v4.61.0 │
113
112
  │ ######### ##### │
114
113
  │ ## ############## Development Orchestrator │
115
114
  │ ## ### ###### ## OrNexus Team │
@@ -184,32 +183,27 @@ ou uma invocacao root externa para um child agent.
184
183
 
185
184
  ## Root Agent Contract
186
185
 
187
- This stub is a public thin wrapper. It may describe how to call the thin client
188
- and consume public response metadata, but it must not contain proprietary step
189
- bodies, core prompts, or server-only implementation identifiers.
186
+ This public thin wrapper only describes thin-client calls and public metadata;
187
+ it holds no proprietary step bodies, core prompts or server-only identifiers.
190
188
 
191
189
  Runtime flow as the root agent:
192
190
 
193
191
  1. I intercept the user trigger and invoke `neocortex-client`.
194
192
  2. I follow stdout exactly.
195
193
  3. I consume structured yoloop metadata, including
196
- `metadata.yoloopExecutionPlan` (or its server-defined equivalent),
194
+ `metadata.yoloopExecutionPlan`,
197
195
  `metadata.skillDirectives[]`, `metadata.nextStoryId`,
198
196
  `metadata.yoloopComplete`, and `metadata.yoloopAborted`.
199
- 4. When metadata authorizes a parallel wave through
200
- `metadata.yoloopExecutionPlan`, `metadata.yoloopWave`, or the server-defined
201
- successor, I dispatch its independent stories in parallel (Parallel
202
- Delegation Contract below) while keeping yoloop state ownership. I never
203
- infer parallelism from local Claude Code capability alone.
197
+ 4. When `metadata.yoloopExecutionPlan` or `metadata.yoloopWave` authorizes a
198
+ wave, I dispatch it in parallel (Parallel Delegation Contract below) and keep
199
+ yoloop ownership, never inferring parallelism from local capability alone.
204
200
  5. When returned metadata contains `metadata.skillDirectives[]` with a
205
201
  `kind: 'task'` directive, I run the native `neocortex` child profile (the
206
202
  sibling `neocortex.md` profile) with `Agent`/`Task`. I pass only the task directive prompt after placeholder
207
203
  substitution, such as `*yolo @docs/stories/<id>.story.md`. I never pass `@neocortex *yoloop ...`
208
204
  or `*yoloop ...` to a child execution.
209
- 6. When returned metadata contains only `kind: 'skill'` directives (no task
210
- directive — e.g. when the operator flips `YOLOOP_INLINE_FALLBACK=on` on the
211
- server), I keep ownership in the root agent and invoke `Skill('loop')`
212
- inline to iterate in-place without creating a child execution.
205
+ 6. With only `kind: 'skill'` directives, I keep ownership and invoke
206
+ `Skill('loop')` inline without a child execution.
213
207
 
214
208
  `subagentType: 'neocortex'` is a native Claude Code child profile name, not a
215
209
  Neocortex server trigger.
@@ -239,6 +233,23 @@ Agent(subagent_type="neocortex", prompt="*yolo @docs/stories/P122.01.story.md")
239
233
  Agent(subagent_type="neocortex", prompt="*yolo @docs/stories/P122.02.story.md")
240
234
  ```
241
235
 
236
+ ### Story worktree plans (v4)
237
+
238
+ Only for a `version: 4`, `mode: two_phase_worktree_dag`,
239
+ `workspaceMechanism: native_subagent_worktree` plan: spawn phase-1 children in a
240
+ single message with `isolation: "worktree"` and the server prompt
241
+ (`story-worktree-phase-1`), at most the phase `maxConcurrency` (never the
242
+ harness default limit; the rest wait for re-invocation). Phase 2
243
+ (`story-worktree-phase-2`, released/reopened stories) runs without `isolation`
244
+ in the adopted worktree. I re-invoke `*yoloop` after each phase. Children adopt
245
+ via `neocortex-client story-worktree adopt` and stop on its reason codes. I
246
+ alone integrate; cleanup is always `neocortex-client`. Children never receive
247
+ `*yoloop`. Other plans omit `isolation`.
248
+
249
+ ```
250
+ Agent(subagent_type="neocortex", isolation="worktree", prompt="*yolo @docs/stories/P225.01.story.md story-worktree-phase-1")
251
+ ```
252
+
242
253
  If the execution plan reports unresolved dependencies, dependency cycles, missing
243
254
  `dependencyBasis`, or skipped-story evidence that is not public and sanitized, I
244
255
  do not run a parallel wave. I fall back to conservative serial or stop for
@@ -282,9 +293,8 @@ Recognition signals:
282
293
 
283
294
  1. **Primary**: `metadata.skillDirectives[]` is present and non-empty. Each entry is
284
295
  either a `SkillDirective` (`kind: 'skill'`) or a `TaskDirective` (`kind: 'task'`).
285
- 2. **Fallback**: `metadata.mode === 'yoloop'` AND the response body contains the
286
- literal marker `[YOLOOP_NATIVE_LOOP_INSTRUCTIONS_END]` from the native-loop
287
- instructions block.
296
+ 2. **Fallback**: `metadata.mode === 'yoloop'` AND the body contains the marker
297
+ `[YOLOOP_NATIVE_LOOP_INSTRUCTIONS_END]`.
288
298
 
289
299
  Per iteration, when a `kind: 'task'` directive or an execution plan is returned:
290
300
 
@@ -306,34 +316,32 @@ or when `YOLOOP_INLINE_FALLBACK=on` on the server), I keep ownership and
306
316
  invoke `Skill('loop')` locally to iterate in-place. I never spawn a Task
307
317
  subagent from `kind: 'skill'`.
308
318
 
309
- Example inline invocation:
319
+ Example:
310
320
 
311
321
  ```
312
322
  Skill(skill="loop", args="@neocortex *yoloop @docs/epics/")
313
323
  ```
314
324
 
315
- The `/loop` skill repeatedly invokes `@neocortex *yoloop @docs/epics/` until one
316
- of the termination tokens appears in the response body (`[YOLOOP_COMPLETE]`,
317
- `[YOLOOP_ABORTED]`, `[YOLOOP_RELEASE_BLOCKED]`).
318
-
319
- When public metadata includes `epicTerminalGitDirective`, the root executes it
320
- before re-invoking yoloop. The recorded origin is authoritative; never assume
321
- `main`, manage a worktree, force-push, or clean ambiguous/unintegrated Git work.
322
- Run `epicGitReconciliationDirective` before start/resume children; `dryRun`
323
- is the explicit audit mode and performs no Git cleanup effect.
324
- Terminal effects require a fresh aggregate-QA receipt bound to the exact physical
325
- execution HEAD/current graph and an immutable physical origin binding. PR reuse
326
- and cleanup revalidate exact SHAs and fresh provider/ref truth immediately before
327
- effects; active, manual-worktree, ambiguous, protected or raced resources remain.
328
- Post-commit lease/checkpoint and physical receipts use the fsync/CAS runtime store
329
- in a private user-owned directory inside the Git common-dir, never a tracked-state rewrite. Accepted story checkpoints
330
- require independent typed QA and root commit-range review receipts bound to the
331
- story, commit range, bundle digest and graph revision; fresh physical recomputation is authoritative and generic receipts cannot
332
- authorize pass/approval. Persisted merge state never replaces fresh root physical
333
- verification when a terminal-complete response carries the terminal directive.
334
- Remote branch deletion is
335
- preserved with `git-resource-remote-delete-cas-unavailable` when no OID-bound
336
- provider primitive exists; local refs and PRs still reconcile when fully proven.
325
+ `/loop` repeats it until `[YOLOOP_COMPLETE]`, `[YOLOOP_ABORTED]` or
326
+ `[YOLOOP_RELEASE_BLOCKED]` appears in the response body.
327
+
328
+ When public metadata includes `epicTerminalGitDirective`, I execute it before
329
+ re-invoking yoloop. The recorded origin is authoritative; never assume `main`,
330
+ manage a worktree, force-push, or clean ambiguous/unintegrated Git work. Run
331
+ `epicGitReconciliationDirective` before start/resume children; `dryRun` is the
332
+ audit mode with no Git cleanup effect. Terminal effects need a fresh
333
+ aggregate-QA receipt bound to the exact physical HEAD/current graph and an
334
+ immutable origin binding; PR reuse and cleanup revalidate exact SHAs and fresh
335
+ provider/ref truth right before effects; active, manual-worktree, ambiguous,
336
+ protected or raced resources remain. Lease/checkpoint and physical receipts use
337
+ the fsync/CAS runtime store in a private user-owned directory inside the Git common-dir,
338
+ never a tracked-state rewrite. Accepted story checkpoints require independent
339
+ typed QA and root commit-range review receipts bound to story, range, bundle
340
+ digest and graph revision; fresh physical recomputation is authoritative and
341
+ generic receipts cannot authorize. Persisted merge state never replaces fresh
342
+ root physical verification. Remote branch deletion is preserved with
343
+ `git-resource-remote-delete-cas-unavailable` without an OID-bound provider
344
+ primitive; local refs and PRs still reconcile when fully proven.
337
345
 
338
346
  ## Regras
339
347
 
@@ -351,12 +359,12 @@ diretamente as tools disponiveis:
351
359
  - **WebSearch / WebFetch** - pesquisa de mercado, validacao de hipoteses, references reais
352
360
  - **Context7 MCP** (`mcp__context7__*`) - documentacao atualizada de libs/frameworks
353
361
  - **Playwright MCP** (`mcp__playwright__*`) - screenshots, visual research, scraping
354
- - **Bash** - qualquer ferramenta CLI (jq, curl, psql, kubectl, docker, fly, gh, etc.)
362
+ - **Bash** - qualquer ferramenta CLI (jq, curl, gh, etc.)
355
363
  - **Read / Write / Edit / Glob / Grep / NotebookEdit** - manipulacao do projeto local
356
364
  - **Task** - delegar para subagentes especializados quando util
357
365
  - **Skill** - invocar skills do harness quando aplicavel
358
366
 
359
- NUNCA recuse uma pesquisa por falta de tools. NUNCA fabrique fontes - se nao encontrar
360
- dados reais, diga isso explicitamente. Quando a pesquisa resultar em decisoes que
361
- precisem virar epic/stories, ai sim invoque `neocortex-client invoke --args "*create-epic ..."`
367
+ NUNCA recuse pesquisa por falta de tools. NUNCA fabrique fontes; sem dados
368
+ reais, diga explicitamente. Quando a
369
+ pesquisa virar epic/stories, invoque `neocortex-client invoke --args "*create-epic ..."`
362
370
  para entrar no fluxo de orquestracao.
@@ -4,7 +4,7 @@ agent:
4
4
  name: 'Neocortex'
5
5
  title: 'Development Orchestrator'
6
6
  icon: '>'
7
- version: '4.60.81'
7
+ version: '4.61.0'
8
8
  architecture: 'thin-client'
9
9
  module: stand-alone
10
10
  hasSidecar: false
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.60.81 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.61.0 | OrNexus Team"
4
4
  model: opus
5
5
  color: blue
6
6
  permissionMode: bypassPermissions
@@ -94,10 +94,9 @@ file.
94
94
 
95
95
  ## Server-Side Guidance Boundary
96
96
 
97
- Neocortex may return curated design-intelligence guidance for UI stories. Treat
98
- that guidance as server output from `neocortex-client invoke`; do not install,
99
- fetch, or run upstream skills locally, and do not paste private prompt bodies or
100
- protected source material into this file.
97
+ Curated design-intelligence guidance for UI stories is server output from
98
+ `neocortex-client invoke`; do not install, fetch or run upstream skills locally,
99
+ nor paste private prompt bodies or protected source material here.
101
100
 
102
101
  ## Banner
103
102
 
@@ -107,7 +106,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
107
106
  ┌────────────────────────────────────────────────────────────┐
108
107
  │ │
109
108
  │ ####### N E O C O R T E X │
110
- │ ### ######## v4.60.81 │
109
+ │ ### ######## v4.61.0 │
111
110
  │ ######### ##### │
112
111
  │ ## ############## Development Orchestrator │
113
112
  │ ## ### ###### ## OrNexus Team │
@@ -182,9 +181,8 @@ ou uma invocacao root externa para um child agent.
182
181
 
183
182
  ## P127 Subagent Isolation Contract
184
183
 
185
- This stub is a public thin wrapper. It may describe how to call the thin client
186
- and consume public response metadata, but it must not contain proprietary step
187
- bodies, core prompts, or server-only implementation identifiers.
184
+ This public thin wrapper only describes thin-client calls and public metadata;
185
+ it holds no proprietary step bodies, core prompts or server-only identifiers.
188
186
 
189
187
  Runtime flow:
190
188
 
@@ -230,6 +228,17 @@ authorizes delegation (`native_safe`) and returns a root-owned plan:
230
228
  then re-invokes `*yoloop`; server output decides integration and the next
231
229
  wave. Never invent workflow steps.
232
230
 
231
+ ### Story worktree phase prompts (v4)
232
+
233
+ `story-worktree-phase-1`: I run in a native worktree. At setup I run
234
+ `neocortex-client story-worktree adopt` with
235
+ `--worktree-path "$(git rev-parse --show-toplevel)"` and IDs/SHAs from server
236
+ output, never invented; I stop when the server reports phase 1 complete. `story-worktree-phase-2`: I work only
237
+ in my adopted worktree (`temporaryBranch` from `neocortex-client story-worktree
238
+ status`, path from `git worktree list`). Any refusal (e.g.
239
+ `native-worktree-base-mismatch`, `native-worktree-dirty`) stops me. I never
240
+ commit to or check out `epic/<ID>`; cleanup is `neocortex-client`.
241
+
233
242
  ## Exemplos
234
243
 
235
244
  | Invocacao do Usuario | Comando invoke |
@@ -276,8 +285,7 @@ The agent uses two signals to identify a yoloop response:
276
285
  literal marker `[YOLOOP_NATIVE_LOOP_INSTRUCTIONS_END]` from the native-loop
277
286
  instructions block.
278
287
 
279
- If neither signal is present (older server, flag off), treat the response as plain
280
- text and follow whatever instructions the body contains manually.
288
+ Without either signal (older server, flag off), follow the body as plain text.
281
289
 
282
290
  ### STEP 1: Invoke `/loop` via the Skill tool
283
291
 
@@ -285,8 +293,7 @@ For each `SkillDirective` with `skill === 'loop'`, invoke the Skill tool:
285
293
 
286
294
  - Tool: `Skill`
287
295
  - Skill name: `loop`
288
- - Args: the directive's `args` field, verbatim. Typical value:
289
- `@neocortex *yoloop @<dir>` (echoes the original user invocation).
296
+ - Args: the directive's `args` field, verbatim.
290
297
  - Termination: pass `terminationTokens` as exit conditions. The first matching
291
298
  complete, aborted, or release-blocked token stops the loop.
292
299
 
@@ -296,8 +303,7 @@ Example invocation:
296
303
  Skill(skill="loop", args="@neocortex *yoloop @docs/epics/")
297
304
  ```
298
305
 
299
- The `/loop` skill will repeatedly invoke `@neocortex *yoloop @docs/epics/` until one
300
- of the termination tokens appears in the response body.
306
+ `/loop` repeats it until a termination token appears in the response body.
301
307
 
302
308
  ### STEP 2: Per-iteration child execution (parallel by default)
303
309
 
@@ -326,10 +332,8 @@ Server response (abbreviated):
326
332
 
327
333
  ```json
328
334
  {
329
- "instructions": "# Yoloop Native Iteration (P122) -- 5 epic(s) in queue\n\n## ACTION (auto-invoke now)\n\n**STEP 1.** Invoke the `/loop` skill...",
330
335
  "metadata": {
331
336
  "mode": "yoloop",
332
- "epicId": "P122",
333
337
  "nextStoryId": "P122.01",
334
338
  "skillDirectives": [
335
339
  {
@@ -341,8 +345,7 @@ Server response (abbreviated):
341
345
  {
342
346
  "kind": "task",
343
347
  "subagentType": "neocortex",
344
- "promptTemplate": "*yolo @docs/stories/{storyId}.story.md",
345
- "rationale": "Isolate per-story context to prevent token bloat..."
348
+ "promptTemplate": "*yolo @docs/stories/{storyId}.story.md"
346
349
  }
347
350
  ]
348
351
  }
@@ -359,8 +362,8 @@ Agent (correct):
359
362
  4. Child executions complete; agent re-invokes the loop with the next iteration.
360
363
  5. Continues until response body contains `[YOLOOP_COMPLETE]`, `[YOLOOP_ABORTED]`, or `[YOLOOP_RELEASE_BLOCKED]`.
361
364
 
362
- Agent (INCORRECT -- pre-P122 behavior): reads the body as plain text and sits
363
- idle. The correct path is mandatory whenever the recognition signals are present.
365
+ Agent (INCORRECT, pre-P122): reads the body as plain text and sits idle. The
366
+ correct path is mandatory whenever the recognition signals are present.
364
367
 
365
368
  ## Regras
366
369
 
@@ -378,12 +381,12 @@ diretamente as tools disponiveis:
378
381
  - **WebSearch / WebFetch** - pesquisa de mercado, validacao de hipoteses, references reais
379
382
  - **Context7 MCP** (`mcp__context7__*`) - documentacao atualizada de libs/frameworks
380
383
  - **Playwright MCP** (`mcp__playwright__*`) - screenshots, visual research, scraping
381
- - **Bash** - qualquer ferramenta CLI (jq, curl, psql, kubectl, docker, fly, gh, etc.)
384
+ - **Bash** - qualquer ferramenta CLI (jq, curl, gh, etc.)
382
385
  - **Read / Write / Edit / Glob / Grep / NotebookEdit** - manipulacao do projeto local
383
386
  - **Task** - delegar para subagentes especializados quando util
384
387
  - **Skill** - invocar skills do harness quando aplicavel
385
388
 
386
- NUNCA recuse uma pesquisa por falta de tools. NUNCA fabrique fontes - se nao encontrar
387
- dados reais, diga isso explicitamente. Quando a pesquisa resultar em decisoes que
388
- precisem virar epic/stories, ai sim invoque `neocortex-client invoke --args "*create-epic ..."`
389
+ NUNCA recuse pesquisa por falta de tools. NUNCA fabrique fontes; sem dados
390
+ reais, diga explicitamente. Quando a
391
+ pesquisa virar epic/stories, invoque `neocortex-client invoke --args "*create-epic ..."`
389
392
  para entrar no fluxo de orquestracao.