8000 DeepSeek Harness (dsh) as a fourth host by adeelahmad · Pull Request #80 · adeelahmad/aloop · GitHub
[go: up one dir, main page]

Skip to content
Merged
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
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# rust — ctx-symbols + md-db: fmt-check, clippy -D warnings, tests; §6 conformance fixtures
# shellcheck — lints every gate script (errors fail the build)
# plugin — JSON sanity + eval-suite validation + `claude plugin validate --strict`
# hosts — Codex hooks emulation + OpenCode plugin end-to-end (no network, no tokens)
# hosts — Codex hooks emulation + OpenCode plugin end-to-end + the dsh plugin on the real,
# pinned DeepSeek Harness runtime against a scripted model (no network, no tokens)
# macos — the host tests and the conformance fixtures on macOS (symlinked /var temp dirs,
# BSD userland): the v0.12.0 release run found two bugs Linux CI never saw
name: CI
Expand Down Expand Up @@ -57,7 +58,7 @@ jobs:
run: make shellcheck

hosts:
name: hosts (codex hooks · opencode plugin)
name: hosts (codex hooks · opencode plugin · dsh plugin)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -69,7 +70,13 @@ jobs:
node-version: "22"
- name: Byte-compile the Python hook scripts
run: make pycheck
- name: Codex hooks emulation + OpenCode plugin end-to-end
- name: Install the pinned DeepSeek Harness (dsh) runtime
# dsh is a preview: pinned, and re-verified on each release (ROADMAP §4.9)
run: |
npm install --prefix "$RUNNER_TEMP/dsh" --no-audit --no-fund @deepseek-ai/dsh@0.2.1-rc.2
echo "DSH_BIN=$RUNNER_TEMP/dsh/node_modules/@deepseek-ai/dsh/lib/bin.js" >> "$GITHUB_ENV"
echo "ALOOP_REQUIRE_DSH=1" >> "$GITHUB_ENV"
- name: Codex hooks emulation + OpenCode plugin + dsh plugin end-to-end
run: make test-hosts

macos:
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ tag in lockstep. Tag releases as `vMAJOR.MINOR.PATCH`.
## [Unreleased]

### Added
- DeepSeek Harness (dsh) host (ROADMAP §4.9): `aloop install dsh` (alias `deepseek`; `--project P` or `--global`) renders a `dsh --profile aloop` profile in `$DSH_HOME` and installs the skills. Its native plugin (`plugin/hosts/dsh/aloop.mjs`) runs the same gates as Claude Code on dsh's own events: a deny before a tool runs, a block after an invalid artifact write, and a stop gate that steers a role back up to 3 times before the supervisor is told it is BLOCKED (or STUCK, released unverified). Roles are agent presets on two subagent tools, one per model route (`deepseek-v4-pro` for planning, `deepseek-flash` for work by default; `MODEL_PLANNING_DSH` / `MODEL_WORKER_DSH` override). A writer's `aloop bind` moves its working directory into its worktree, and `host-adapter` confines its commands, edits and `working_directory` there. Usage is recorded Claude-shaped per role, so budgets, the ledger and `run-summary` work unchanged. `make e2e-live HOST=dsh` drives it live and exits 2 with the fix when no `DEEPSEEK_API_KEY` is set. Reason: DeepSeek's own harness is the cheapest route to a strong model. The profile records the project it serves (or `--global`), so another project's `aloop-init` never re-renders it, and gates get the worker shell's environment (no API key). The mission layer's six roles run on dsh too: presets on their route group's subagent tool, `gate-mission-scope` on every write and command, and `gate-mission-artifact` at each role's start and stop; the mission skill installs as `aloop-mission`. A second review (3 lenses; 11 confirmed findings, each fixed with a test) closed: a working directory that vanished (dsh's tools move it back to the main tree, so the plugin judges `ensure()`'s directory and `host-adapter` refuses to run from a missing one), gate switches from the project's `.env` (dsh loads it; `SKIP_HOOKS`, `GATE_RUN_TESTS`, `REPO_DIR`, `AGENTIC_*` from it never reach a gate), an interrupted Stop that dropped the sprint-close notice, and the shared profile: its owner is the main tree, an older unrecorded profile is claimed only by the project that installed it, and a project it does not serve is told so by `install status`, `aloop-init` and the session itself. Tests: `dsh-plugin.test.mjs` (40 checks, emulated), `dsh-runtime.test.mjs` (32 checks on the real pinned dsh 0.2.1-rc.2 with a scripted model; the CI hosts job installs it) and `dsh-install.test.py` (9).
- Brand kit and repo front page: `docs/brand/` holds the mark (an **a** whose bowl is a red-to-green loop passing a gold gate, with a 16 px cut), lockups, light and dark README banners, favicons, app icons, the site's OG card and the GitHub social preview, all generated by `docs/brand/gen_brand.py` from one palette with WCAG checks (rules in `docs/brand/README.md`). The README leads with the mission layer, the agent principles and the door rule, the supported hosts and the measured demo runs; the site carries the favicon and Open Graph/Twitter card metadata; `SECURITY.md` and bug/feature issue forms are new.
- The mission layer's six fixed roles (ROADMAP §4.12, M9.9): `market-researcher`, `product-tester`, `state-assessor`, `evaluator`, `mission-planner` and `ethics-reviewer`, each a persona with a four-case eval suite, a model route (the four that judge on the planning route, the two that measure on the worker route), hook matchers on Claude Code, Codex and OpenCode, and Codex/OpenCode agents from `aloop install` (which also renders the mission skill for OpenCode as `aloop-mission` once it ships). `plugin/mission/roles.json` names the paths each role writes. `gate-mission-scope` (PreToolUse) is the role path guard: a mission role never writes source, mission.json or another role's dir, never commits and never runs a human's approval; a builder never writes `docs/agents/mission/` or runs a writing `mission` command; the supervisor never hand-writes a role's artifact. No one hand-writes `docs/agents/mission/ledger.jsonl` or the captured prompts a grant reads (`<run data>/transcripts/`), runs a hook's `transcripts prompt|record|…`, or starts a host session from a tool call where a mission is set (its prompt would count as the human's words, M9.17), and no dispatched agent runs `mission baseline restore`, `events authority` or an `events emit` of a human event. `gate-mission-artifact` records what exists when a role starts and, at its stop, requires an artifact in its own paths that passes the core contract and its area's check, refuses a deleted artifact, a change to another role's or a ledger that no longer verifies, and records `artifact.created|updated` as provenance. A mission write never arms the sprint lock. The scope gate reads a Bash command as the shell would (`_shellread.py`: quotes, comments, line continuations, heredocs, wrappers such as `timeout` and `env`, `bash -c`, `eval`, a script run by an interpreter, variables and `$(mktemp)`). Each area's check runs once per artifact with its id or subject, an ethics hard line is the reviewer's finding, not a defect, and a derived goal whose only blocks are its pending ethics review waits on the Ethics Reviewer, not on the planner. Test: `mission-roles.test.py` (32 checks, with each role run through the real journeys, baseline, assess, evaluate and ethics, goal, research and judge areas), `mission-scope-bash.test.py` (220 commands), `opencode-plugin.test.mjs`.
- The mission layer's six fixed roles (ROADMAP §4.12, M9.9): `market-researcher`, `product-tester`, `state-assessor`, `evaluator`, `mission-planner` and `ethics-reviewer`, each a persona with a four-case eval suite, a model route (the four that judge on the planning route, the two that measure on the worker route), hook matchers on Claude Code, Codex, OpenCode and dsh, and Codex/OpenCode agents and dsh presets from `aloop install` (which also renders the mission skill for OpenCode as `aloop-mission` once it ships). `plugin/mission/roles.json` names the paths each role writes. `gate-mission-scope` (PreToolUse) is the role path guard: a mission role never writes source, mission.json or another role's dir, never commits and never runs a human's approval; a builder never writes `docs/agents/mission/` or runs a writing `mission` command; the supervisor never hand-writes a role's artifact. No one hand-writes `docs/agents/mission/ledger.jsonl` or the captured prompts a grant reads (`<run data>/transcripts/`), runs a hook's `transcripts prompt|record|…`, or starts a host session (`claude -p`, `codex exec`, `opencode run`, `dsh <profile>`) from a tool call where a mission is set (its prompt would count as the human's words, M9.17), and no dispatched agent runs `mission baseline restore`, `events authority` or an `events emit` of a human event. `gate-mission-artifact` records what exists when a role starts and, at its stop, requires an artifact in its own paths that passes the core contract and its area's check, refuses a deleted artifact, a change to another role's or a ledger that no longer verifies, and records `artifact.created|updated` as provenance. A mission write never arms the sprint lock. The scope gate reads a Bash command as the shell would (`_shellread.py`: quotes, comments, line continuations, heredocs, wrappers such as `timeout` and `env`, `bash -c`, `eval`, a script run by an interpreter, variables and `$(mktemp)`). Each area's check runs once per artifact with its id or subject, an ethics hard line is the reviewer's finding, not a defect, and a derived goal whose only blocks are its pending ethics review waits on the Ethics Reviewer, not on the planner. Test: `mission-roles.test.py` (33 checks, with each role run through the real journeys, baseline, assess, evaluate and ethics, goal, research and judge areas), `mission-scope-bash.test.py` (225 commands), `opencode-plugin.test.mjs`.
- The mission loop end to end, offline (ROADMAP §4.12, M9.13): `mission-e2e.test.py` drives `mission tick` from a new mission through research, a journey, a confirmed baseline, a gap list, a goal, its intents and one Aladdin sprint per intent to GOAL MET and the next raise of the bar, with zero tokens and each step done through the CLI the way its role or the human does it. A fresh clone hands out the same action. Ethics reviews and hard lines are now ledger rows (M9.24), so a clone no longer asks for every review again or forgets a hard line; the ledger row wins over its run-log copy, and a broken ledger makes every ethics verdict `broken`. Tests: `mission-e2e.test.py`, `mission-ethics.test.py`.
- A mission baseline binds the mission's direction (ROADMAP §4.12, M9.25): `direction_sha256` covers the mission id, statement, mode and constraints, so raising a budget cap or changing the cadence (and approving it) keeps the confirmed baseline, while a new direction still asks for a new version. Reason: M9.8's budget test, a raised cap asked for a new baseline though "best" had not changed. Test: `mission-baseline.test.py`.
- Mission approvals are the human's own words (ROADMAP §4.12, M9.17): `mission approve`, `baseline confirm|restore`, `journeys approve`, `mission ethics consent` and `mission telemetry consent` record only when a prompt the `UserPromptSubmit` hook captured has a line such as `approve msn_… 3f2a9c1b` (the verb and the first 8 hex of the content's sha256); until then they ask (exit 3) with that line. `--by` alone, a negated line, another code, a line older than a later decision about the subject (for a baseline, any version's confirmation) and a hand-appended ledger row without such a line grant nothing. Reason: an approval was only as strong as `--by`, so a role could approve its own mission change. Tests: `mission-core.test.py`, `mission-baseline.test.py`.
Expand Down Expand Up @@ -80,6 +81,11 @@ tag in lockstep. Tag releases as `vMAJOR.MINOR.PATCH`.
- `make conformance` now covers ROADMAP §6.1 and §6.10–6.20 (except 6.15) by running the focused test of the tool that holds each item. Before this, its report said those items "do not exist yet", though they shipped in v0.12.0. It now reports 74 checks across 19 of the 20 items. §6.15 (re-decomposition) stays explicit: it is measured by live runs. CI's rust job sets up Node 22 for the OpenCode test.

### Fixed
- `host-adapter` lifts a writer's confinement only for a bare `aloop bind <worktree>` made of plain words (a redirect to `/dev/null` or `2>&1` may follow): a bind in a comment, chained to another command (`make gen; aloop bind /wt`, `aloop bind /wt;echo>x`) or holding a `$(…)` used to skip every check on Codex. Test: `host-adapter.test.py`.
- `gate-supervisor-scope` treats source inside a task worktree (`.aladdin/worktrees/<id>/…`) as production source, so a supervisor can no longer hand-edit a worker's code there during a sprint; the worktree's own marker dir stays a control file. It judges a path where the write lands (`..` and symlinks resolved), so `.aladdin/../src/x.rs` is source, and its task.env fallback exempts only a sub-agent, never the supervisor's hook run inside a worktree after a `cd` (all hosts). Test: `supervisor-scope.test.py`.
- `e2e-live.sh`'s seed init re-renders no host install (`ALOOP_NO_HOST_RERENDER=1`), so a run no longer rewrites the user's global Codex agents. Test: `e2e-live-hosts.test.py`.
- `gate-validate-artifact`, `gate-intake` and `gate-memory` default `CLAUDE_PLUGIN_ROOT` like the other gates: without it (OpenCode, dsh) the first blocked every valid planning artifact with an unbound-variable crash and the other two skipped their schema check.
- `capabilities.json` gives OpenCode `gate_blocking: outer`, matching its adapter's `enforce_gate` (its stop gates run through the outer controller); `host-adapter.test.py` now fails when the matrix and an adapter disagree.
- The gates find `standards.md` from a worker's worktree. The standards role writes it to `docs/agents/sprintN/`, which is git-ignored and so absent from every worktree, and the gates looked only in the worktree. Every RED, GREEN and final gate in a worktree therefore ran the default Rust matrix instead of the project's own. They now read it from the story's sprint (`STORY_DIR`), then this tree, then the main tree. A non-cargo project with no matrix at all now blocks with a message naming `standards.md`, instead of running `cargo fmt`. Found by live run 36 (Python). Test: `scripts/test/any-language.test.py`.
- `ctx-symbols conflicts` skips `.aladdin/`. `aloop task-worktree add` checkouts live under `.aladdin/worktrees/`, and a merged one duplicated every symbol of main as HIGH findings (run 36: 4 structural-review rejections).
- GREEN and the final gate refuse skipped tests in Python, Go and JS/TS, as they already did `#[ignore]` in Rust: `@pytest.mark.skip`/`skipif`/`xfail`, `pytest.skip(`, `@unittest.skip`, `t.Skip(`, `.skip(`, `xit(`, `xdescribe(`. Before, the check scanned only `*.rs`. The final gate now also finds a planned Python or Go test by its `def` or `func`; before, it looked only for `fn` and so blocked every planned Python test as missing. Test: `scripts/test/any-language.test.py`.
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ pycheck: ## Byte-compile the Python hook scripts
&& rm -rf plugin/bin/__pycache__ plugin/mission/__pycache__ && echo "python ok"

.PHONY: test-hosts
test-hosts: ## Budget/worktree regression + Codex hooks emulation + OpenCode plugin end-to-end (no network, no tokens)
@command -v node >/dev/null && node --check plugin/hosts/opencode/aloop.js
test-hosts: ## Budget/worktree regression + Codex hooks emulation + OpenCode and dsh plugins end-to-end (no network, no tokens)
@command -v node >/dev/null && node --check plugin/hosts/opencode/aloop.js && node --check plugin/hosts/dsh/aloop.mjs
python3 scripts/test/budget-worktree.test.py
python3 scripts/test/budget-soft-telemetry.test.py
python3 scripts/test/budget-hard-stop.test.py
Expand All @@ -104,6 +104,7 @@ test-hosts: ## Budget/worktree regression + Codex hooks emulation + OpenCode plu
python3 scripts/test/context-boundary.test.py
python3 scripts/test/model-routes.test.py
python3 scripts/test/host-adapter.test.py
python3 scripts/test/dsh-install.test.py
python3 scripts/test/portable-config.test.py
python3 scripts/test/host-swap.test.py
python3 scripts/test/aladdin-cli.test.py
Expand Down Expand Up @@ -134,6 +135,7 @@ test-hosts: ## Budget/worktree regression + Codex hooks emulation + OpenCode plu
python3 scripts/test/skill-layout.test.py
@for t in scripts/test/mission-*.test.py; do [ -e "$$t" ] || continue; echo "python3 $$t"; python3 "$$t" || exit 1; done
@if command -v node >/dev/null; then node scripts/test/opencode-plugin.test.mjs; else echo "node not found — skipped OpenCode test (CI runs it)"; fi
@if command -v node >/dev/null; then node scripts/test/dsh-plugin.test.mjs && node scripts/test/dsh-runtime.test.mjs; else echo "node not found — skipped dsh tests (CI runs them)"; fi

.PHONY: conformance
conformance: ## ROADMAP §6 conformance fixtures on today's gates (needs cargo; no network, no tokens)
Expand Down
Loading
Loading
0