Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,33 @@ All notable changes to codexclaw are documented here. The format follows

## [Unreleased]

### Changed

- Formal P now requires an architect proposal, a main-owned executable plan and
reflection by the same architect before independent audit. C0/C1 fast paths and
explicit user limits keep their existing precedence; this adds guidance, not a
runtime gate.

### Fixed

- Native V2 spawn hooks preserve canonical Fernet-shaped task messages without
appending plaintext skill affordances or leaf guards. Structural validation
rejects malformed lookalikes; omission notices identify the guards that could
not be attached. Ciphertext recognition does not authenticate the message.

- Subagent waiting guidance instructed coordinators to retire workers after
about three empty waits, even when analysis could still be progressing.
`waiting.md` now requires evidence of progress or stagnation, preserves
unavailable observations, and uses non-interrupting checkpoints. Delegation
and DISPATCH-RETIRE-01 clarify actual shutdown checks and managed recovery;
cancellation or exhausted limits grant no retry or replacement. Progress
assessment remains agent-followed (#178).
- Managed dispatch now accepts explicit `task_failed` reports for confirmed
stagnation or unusable final output. A recorded stopped child, task evidence
and reconciliation are required before the existing bounded handoff can run.
Provider errors keep their existing classification; cancellation and permission
denials cannot be overridden by a task-failure label (#178).

## [0.2.28] - 2026-09-14

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<p align="center">
<a href="https://github.com/lidge-jun/codexclaw/actions/workflows/ci.yml"><img src="https://github.com/lidge-jun/codexclaw/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<img src="https://img.shields.io/badge/tests-3%2C150_passing-brightgreen" alt="3,150 tests passing">
<img src="https://img.shields.io/badge/tests-3%2C177_passing-brightgreen" alt="3,177 tests passing">
<img src="https://img.shields.io/badge/skills-29-blue" alt="29 skills">
<img src="https://img.shields.io/badge/hooks-28-blue" alt="28 hooks">
<a href="https://lidge-jun.github.io/codexclaw/"><img src="https://img.shields.io/badge/docs-codexclaw-black" alt="Documentation"></a>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<p align="center">
<a href="https://github.com/lidge-jun/codexclaw/actions/workflows/ci.yml"><img src="https://github.com/lidge-jun/codexclaw/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<img src="https://img.shields.io/badge/tests-3%2C150_passing-brightgreen" alt="3,150 tests passing">
<img src="https://img.shields.io/badge/tests-3%2C177_passing-brightgreen" alt="3,177 tests passing">
<img src="https://img.shields.io/badge/skills-29-blue" alt="29 skills">
<img src="https://img.shields.io/badge/hooks-28-blue" alt="28 hooks">
<a href="https://lidge-jun.github.io/codexclaw/"><img src="https://img.shields.io/badge/docs-codexclaw-black" alt="Documentation"></a>
Expand Down
2 changes: 1 addition & 1 deletion README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<p align="center">
<a href="https://github.com/lidge-jun/codexclaw/actions/workflows/ci.yml"><img src="https://github.com/lidge-jun/codexclaw/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<img src="https://img.shields.io/badge/tests-3%2C150_passing-brightgreen" alt="3,150 tests passing">
<img src="https://img.shields.io/badge/tests-3%2C177_passing-brightgreen" alt="3,177 tests passing">
<img src="https://img.shields.io/badge/skills-29-blue" alt="29 skills">
<img src="https://img.shields.io/badge/hooks-28-blue" alt="28 hooks">
<a href="https://lidge-jun.github.io/codexclaw/"><img src="https://img.shields.io/badge/docs-codexclaw-black" alt="Documentation"></a>
Expand Down
50 changes: 50 additions & 0 deletions devlog/_fin/260916_selective_execution/000_plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Architect consultation with existing delegation policy

Formal-P architect consultation needs a concrete proposal, a main-owned executable
plan and reflection by the same architect before independent review. Consolidate
the architect and recovery fixes from #177 and #179 while preserving CXC's
existing delegation-selection policy. Neither executor-first nor main-direct
implementation becomes a new default.

## Scope

Class: C3 compact policy/hint integration. No new delegation-selection rule,
runtime gate, dependency or model setting. Preserve reviewed ciphertext handling
and task failure recovery. Main applies the bounded correction; independent
review checks the changed instructions and emitted output.

- Restore `plugins/codexclaw/skills/dev/SKILL.md` exactly to upstream 03541398.
- Remove added implementation-ownership sections from P plan output, B guidance
and structure mirrors. Existing DISPATCH-ECONOMY-01 remains the selection owner.
- Keep formal-P consultation records and P/A hook reminders. CLI P entry repeats
only the architect sequence; B returns to its original instructions/output.
- Keep ciphertext preservation from #177 and retirement/task-failure recovery
from #179. Their existing managed-dispatch bounds and stop precedence remain.
- Update hook/CLI assertions to cover architect output, unchanged phase state and
absence of the added implementation-default instructions.
- Align PR/issue descriptions, local source, installed files and reapply patches.

## Acceptance

1. No new executor-first or main-direct default remains in active policy.
2. The canonical dev skill equals upstream bytes; existing delegation criteria
and build-phase instructions remain unchanged.
3. Formal P requires architect proposal, main plan and same-architect reflection
before independent audit, subject to existing fast paths and explicit limits.
4. #179's evidence-based retirement and reconciled task-failure recovery remain.
5. Source/dist, affected tests, build, full suite, gate/inventory, independent
review and installed CLI/hook checks agree.
6. One ordinary PR targets dev. #177 and #179 are superseded without deleting their
branches; #178 stays open until upstream integration.
7. Local and installed corrections have drift checks, backups and verified patches.
No upstream merge, release or model-setting change is authorized here.

## Review context

The initial architect proposal and reflection established the retained
consultation/transport/recovery boundaries. A later clarification withdraws the
added implementation-default policy and restores the upstream selection rules.
This correction adds no new architecture decision; it removes the unsupported
policy extension. The earlier reviews do not certify the corrected diff: a fresh
independent review and checks cover delivery. Private receipts retain both
revisions without presenting the withdrawn plan as current behavior.
50 changes: 50 additions & 0 deletions devlog/_fin/260916_selective_execution/010_implementation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Architect and recovery consolidation

The final change strengthens formal-P architect consultation while keeping CXC's
existing delegation-selection rules. It preserves the transport and recovery
fixes from #177 and #179 without introducing an executor-first or main-direct
implementation default.

## Changes and provenance

Credits: thisisjun786, original contributions in #177 and #179.

The canonical dev skill is restored byte-for-byte to upstream 03541398. Added
implementation ownership sections and P/B ownership hints are removed. Formal P
retains proposal, main plan and same-architect reflection before independent audit;
the CLI repeats that sequence only at P entry. Existing fast paths, explicit
limits, DISPATCH-ECONOMY-01 and B guidance keep their original roles.

The complete subagent-config component and the waiting/delegation recovery
references retain the reviewed combined implementation. Recovery requires the
registered stopped child and reconciliation; cancellation and permission failures
still stop. Ciphertext shape recognition preserves opaque native messages and
reports omitted prompt instructions without claiming authentication.

## Verification

Fresh checks on the corrected revision:

- Independent review: PASS, no blockers. Baseline comparisons confirm the original
dev skill, B guidance and DISPATCH-ECONOMY-01; recovery/ciphertext files are unchanged.
- Phase hook/CLI suite: 185 pass, zero failures.
- `npm run build`: exit 0, 181 compiled files.
- `TMPDIR=<isolated directory> CODEXCLAW_SKIP_REPOMAP_SMOKE=1 npm test`:
exit 0, 3177 total, 3103 pass, 74 conditional skips, zero failures.
- `npm run gate`, `inventory.mjs --check --tests 3177` and `git diff --check`: pass.
- Compiled CLI/hook QA: five real invocations each on source and installation
check architect output at P and unchanged B instructions/phase behavior.
- Installed recovery QA: 35 CLI invocations pass, including stopped-child
recovery, live/unknown reconciliation, evidence limits and stop precedence.
- Nine changed installed files pass pre-write drift checks. The installed dev
skill matches upstream bytes. Patch reverse/reapply matches before/after copies.

These checks use isolated fixtures and spawn no live provider or worker.
Agent-followed policy remains a semantic-review obligation. Raw logs, review
receipts and patch proofs remain in the private correction backup.

## Delivery

#180 supersedes closed #177 and #179. Original branches are preserved. #178 tracks
the retained recovery work and stays open until upstream integration. Source and
installation updates are separate from upstream merge or release.
39 changes: 28 additions & 11 deletions docs-site/src/content/docs/guides/subagents.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Four roles cover the common subagent workflow:
- **executor** — focused implementation.
- **architect** — read-only design proposals and checks of main-owned executable plans.

Formal P keeps the required design sequence: architect proposal, main's executable
plan, then reflection by the same architect before independent review. The existing
C0/C1 fast path and explicit user limits still apply. See the
[workflow guide](/codexclaw/guides/pabcd/) for phase requirements.

## Native architect setup

Architect uses `agent_type: "architect"`, its own model/effort/prompt settings and
Expand Down Expand Up @@ -56,14 +61,15 @@ surfaces, but it does not choose skills. Dispatchers explicitly name each requir
skill with preferred `[$cxc-<name>](skill://<abs SKILL.md>)` links or the plugin-native
`$codexclaw:cxc-<name>` fallback. When the spawn message is plaintext, the hook normalizes
known broken/bare mentions and inlines recognized SKILL.md bodies on V2-shaped spawns.
Native ChatGPT-backend V2 gives the hook ciphertext, so both operations are no-ops there;
when no body can be inlined, it appends a plaintext `[CXC-SKILL-AFFORDANCE]` block telling
the child to self-load any `$cxc-<folder>` / `$codexclaw:cxc-<folder>` mention from
`<skillsDir>/<folder>/SKILL.md`; fork inheritance remains a secondary channel. Its other
reliable native V2 channels are the leaf guard and omitted configured
`model`/`reasoning_effort` injection for non-full-history spawns. It never invents role
baselines or inferred surface skills. Role config, resolver, and spawn-wrapper are all
shipped (L9).
Native ChatGPT-backend V2 can give the hook ciphertext. Recognized canonical
Fernet-shaped messages are preserved byte-for-byte: no skill text, affordance or
leaf guard is appended to them. The hook reports the omitted prompt guards;
structural checks identify an opaque frame but do not authenticate or decrypt it.
For plaintext messages where no skill body can be inlined, the hook appends a
`[CXC-SKILL-AFFORDANCE]` telling the child to self-load named skills. Configured
omitted `model`/`reasoning_effort` injection remains available for non-full-history
spawns. It never invents role baselines or inferred surface skills. Role config,
resolver, and spawn-wrapper are all shipped (L9).

## First fallback

Expand All @@ -82,9 +88,11 @@ cxc subagents set executor --fallback-model cursor/grok-4.6 --fallback-effort hi
cxc subagents set executor --clear-fallback
```

The same flags apply to explorer and reviewer. When both attempts fail, the main
agent takes over remaining work. An independent review requirement remains
outstanding; main-agent work does not satisfy it.
The same flags apply to explorer, reviewer and architect. Only a returned
`main-direct` action permits main to reclaim remaining work from a managed dispatch.
A `ready` action requires a fresh claim; `stop` or `reconcile` permits neither a
replacement nor direct takeover. Independent review remains outstanding when
required; main-agent work does not satisfy it.

### Execution and evidence

Expand All @@ -106,6 +114,15 @@ authentication and cancellation failures stop. Ambiguous creation or ongoing wor
must be reconciled before replacement; stopped executors require a change review
and cleanup evidence. Unknown error prose does not trigger blind rotation.

Confirmed stagnation or unusable final output uses a separate `outcome:task_failed`
report with `taskFailure: {kind: "stagnation" | "unusable_output", evidence: "..."}`.
Include the recorded child ID, `executionState:stopped`, and `reconciliation`
describing termination and partial-work inspection. Both evidence strings must be
non-empty and at most 2000 characters. This report has no provider `error`; it uses
the same bounded handoff and returned actions as provider recovery. Cancellation,
exhausted limits and a wait timeout alone are not task failures. Validate final
work before reporting `outcome:complete`, which cannot be reopened for recovery.

OCX retains its own retries and global/per-model fallback. The two-attempt limit
applies to CXC-issued native attempts, not every downstream provider request.
Requested and observed models are recorded separately; an unobserved actual model
Expand Down
2 changes: 2 additions & 0 deletions plugins/codexclaw/components/pabcd-state/dist/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,15 @@ const PHASE_DIRECTIVES = {
"[codexclaw: PLAN]",
"Apply this pointer and its owners within exact user limits and permissions. No-delegation means no dispatch.",
"Load $codexclaw:cxc-pabcd for P and C2+ plan-output; $codexclaw:cxc-dev selects class and relevant surfaces. No implementation yet.",
"Formal P, including C2 compact and plan-only P: obtain the configured read-only architect proposal BEFORE the executable plan, send that concrete plan to the SAME architect for reflection BEFORE A, and record the consultation per $codexclaw:cxc-pabcd phase-plan/plan-output. The C0/C1 fast path needs none.",
"Plan-only ends with the plan. Forbidden checks: NOT RUN; naming an artifact grants no write permission.",
].join("\n"),
A: [
"[codexclaw: AUDIT]",
"Apply this pointer and its owners within exact user limits and permissions. No-delegation means no dispatch.",
"Load $codexclaw:cxc-dev-code-reviewer for review and $codexclaw:cxc-dev for relevant surfaces; authorized PABCD A uses $codexclaw:cxc-pabcd's audit owner. Do not build yet.",
"Authorized dispatch follows the owner's named-skill, same-reviewer and verdict contracts; main synthesizes. Report unmet independent review; inline review is not its proof. Do not bypass gates.",
"An amendment changing a module-responsibility, data-structure, interface or execution-flow decision needs reflection from the SAME architect before A completes ($codexclaw:cxc-pabcd phase-audit); text/test clarification alone does not. The reviewer stays independent.",
].join("\n"),
B: [
"[codexclaw: BUILD]",
Expand Down
14 changes: 12 additions & 2 deletions plugins/codexclaw/components/pabcd-state/dist/orchestrate-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,16 @@ function hasPabcdCloseRow(
);
}

/**
* CLI entry can reach P without a UserPromptSubmit turn. Repeat the formal-P
* architect consultation pointer there. Advice only; no new phase gate.
*/
function withArchitectHint(phase , output ) {
return phase === "P"
? `${output} [formal P: architect proposal -> main executable plan -> same-architect reflection before A (cxc-pabcd phase-plan)]`
: output;
}

export function runOrchestrateCli(args , commitHooks = {}, nativeEnv = {}) {
if ("help" in args) return { code: 0, output: renderOrchestrateHelp() };

Expand Down Expand Up @@ -653,7 +663,7 @@ export function runOrchestrateCli(args
scanEvidence: { scanRounds: state.interview?.scanRounds ?? 0, highContradictionCount: gate.highContradictionCount },
...(args.attest?.did ? { evidence: args.attest.did } : {}),
});
return { code: 0, output: `orchestrate P: I → P (agent override, session ${sessionId})` };
return { code: 0, output: withArchitectHint("P", `orchestrate P: I → P (agent override, session ${sessionId})`) };
} else {
// Not ready and no override: advise-block with gate warnings.
return {
Expand Down Expand Up @@ -1118,7 +1128,7 @@ export function runOrchestrateCli(args
reason: "cli",
...(args.attest?.did ? { evidence: args.attest.did } : {}),
});
return { code: 0, output: `orchestrate ${args.verb}: current=${state.phase} -> ${result.state.phase} (${state.phase} → ${result.state.phase}, session ${sessionId})` };
return { code: 0, output: withArchitectHint(result.state.phase, `orchestrate ${args.verb}: current=${state.phase} -> ${result.state.phase} (${state.phase} → ${result.state.phase}, session ${sessionId})`) };
}
/**
* #48: candidate trees to check for the SAME session id. Deliberately shallow —
Expand Down
2 changes: 2 additions & 0 deletions plugins/codexclaw/components/pabcd-state/src/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,15 @@ const PHASE_DIRECTIVES: Partial<Record<Phase, string>> = {
"[codexclaw: PLAN]",
"Apply this pointer and its owners within exact user limits and permissions. No-delegation means no dispatch.",
"Load $codexclaw:cxc-pabcd for P and C2+ plan-output; $codexclaw:cxc-dev selects class and relevant surfaces. No implementation yet.",
"Formal P, including C2 compact and plan-only P: obtain the configured read-only architect proposal BEFORE the executable plan, send that concrete plan to the SAME architect for reflection BEFORE A, and record the consultation per $codexclaw:cxc-pabcd phase-plan/plan-output. The C0/C1 fast path needs none.",
"Plan-only ends with the plan. Forbidden checks: NOT RUN; naming an artifact grants no write permission.",
].join("\n"),
A: [
"[codexclaw: AUDIT]",
"Apply this pointer and its owners within exact user limits and permissions. No-delegation means no dispatch.",
"Load $codexclaw:cxc-dev-code-reviewer for review and $codexclaw:cxc-dev for relevant surfaces; authorized PABCD A uses $codexclaw:cxc-pabcd's audit owner. Do not build yet.",
"Authorized dispatch follows the owner's named-skill, same-reviewer and verdict contracts; main synthesizes. Report unmet independent review; inline review is not its proof. Do not bypass gates.",
"An amendment changing a module-responsibility, data-structure, interface or execution-flow decision needs reflection from the SAME architect before A completes ($codexclaw:cxc-pabcd phase-audit); text/test clarification alone does not. The reviewer stays independent.",
].join("\n"),
B: [
"[codexclaw: BUILD]",
Expand Down
Loading
Loading