Skip to content

cstack init: one-command durable setup; no memory ledger in agent mode; Tailscale optional - #85

Merged
Akilleez-QA merged 3 commits into
mainfrom
feat/cstack-init
Nov 17, 2026
Merged

Akilleez-QA merged 3 commits into
mainfrom
feat/cstack-init

Conversation

@Akilleez-QA

@Akilleez-QA Akilleez-QA commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Wave 2, workstream F. One command sets up a working, durable stack; agent mode refuses the memory ledger; Tailscale becomes optional. Critic findings B2 and M9.

Intended commit message

Add cstack init; refuse the memory ledger in agent mode; make Tailscale optional. Requirements CS-REQ-084, CS-REQ-085, CS-REQ-086; design SDD-C28 (and SDD-C15 for CS-REQ-085).

What changes

  • cstack init (tools/cstack_init.py, adapters/local_setup.py): makes a private state folder (~/.local/state/cstack, 0700 folders, 0600 files), records the device name, generates a signing key per bot in aors/fleet.json plus two local witness keys, writes the DECISION-004 roster, per-bot anchors and ledger.json (last, so a half-finished run is never taken as set up). Idempotent: a repeat changes nothing, a partial setup is finished with the keys already made, new bots are added, loose permissions are made private. It never replaces or repairs a key that is readable by others or that does not match the roster. --check changes nothing, verifies every ledger file's signatures and chain, and exits 1 on any problem. Output is plain language with the fix for each problem and the next commands.
  • Agent mode refuses the memory ledger: tools/cstack_mcp.py exits 2 before creating any state when the state root has no ledger.json, with a message naming python -B tools/cstack_init.py. --allow-memory-ledger keeps the memory ledger for tests and throwaway development. Enforced check: tests/test_cstack_init.py::LauncherTests.test_generated_bot_profiles_never_allow_the_memory_ledger fails if tools/agent_profiles.py ever emits that flag.
  • Tailscale optional: device is --device, else the name init recorded, else the tailnet name. Init records --device, an earlier record, the tailnet name, or the computer's name, and falls back to the fleet's only device when the found name is unlisted. An absent, failing or signed-out Tailscale yields no name rather than an error. tailnet_hostname moved from tools/cstack_mcp.py to adapters/local_setup.py.
  • cryptography==50.0.2 moved from ci/requirements.txt to requirements.txt (the witnessed ledger is now the default, not a test extra).
  • Docs: new how-to Set up Cstack; README install section, first-run tutorial, define-bots, commands/configuration/environment references, server-and-adapters explanation and CHANGELOG updated. tools/check_readme.py runs cstack init + --check in a scratch HOME and inits before its MCP session.

IDs and shared files (for merge with sibling branches)

  • Requirements: CS-REQ-084, CS-REQ-085, CS-REQ-086 (Draft). Design: SDD-C28 (new), SDD-C15 gains CS-REQ-085. Checked against open PR Serve the pinned Foundations as read-only MCP tools for one bot #84 (CS-REQ-091, SDD-C31) and the in-flight sibling branches (CS-REQ-080 to 083, SDD-C26; CS-REQ-087, SDD-C29): no overlap. This PR does not use CS-REQ-091 or SDD-C31.
  • Shared files touched minimally: contracts/ADAPTERS.json (two host_config rows + cstack-mcp vendor/notes), docs/requirements/requirements.md, docs/verification/verification-matrix.md, docs/architecture/architecture.md (one row each plus revision rows; version bumps SRS 2.2, VM 2.2, SDD 2.3 may conflict with siblings), requirements.txt, ci/requirements.txt, CHANGELOG.md.
  • Not touched: poodo_core/, bootstrap.py, adapters/mcp_stdio_server.py.

Checks (macOS, Python 3.13 throwaway venv with requirements.txt + ci/requirements.txt; HOME and XDG_STATE_HOME in scratch; no model calls; Anthropic credential variables unset; no npm ci, same for both runs)

Check main 0a9703b this branch
python -B -m unittest discover -s tests 734 run, 76 failures, 4 errors, 8 skipped 758 run, 77 failures, 4 errors, 8 skipped
Failure set vs main — identical except test_process_and_cli.ExecutorTests.test_cancellation_terminates_and_no_partial_evidence, a timing test that failed once under parallel load and passes 3/3 rerun alone
tests.test_cstack_init (-B and -B -O) — 25 tests OK
python -B tools/check_trace.py — 80 requirements, 0 failures; 77/77 test files traced
python -B tools/check_links.py — 0 broken
Personal-data scan of the diff — none (fixture names only)
trufflehog / gitleaks — not installed locally; CI secrets job runs trufflehog

The main-baseline failures are the known macOS ones (vendored EndoForge os.fdatasync, plus workcell tests needing node_modules); Linux CI should be the real gate.

Not done

  • Witnesses: init's two witness keys live on the same machine, so the ledger is durable and signed but not independently witnessed; documented in the guide and README limitations.
  • Registering a fleet from workstream A's starter agents (waits for A to land); the Claude Code trust step in init (workstream H).
  • tools/check_readme.py was not run end to end here (it needs a clone and runs the forge, which fails on macOS).
  • Exposed as python -B tools/cstack_init.py; there is no cstack console entry point in this repo yet.

🤖 Generated with Claude Code

…le optional

One command (python -B tools/cstack_init.py) sets up a private state
folder and a durable, signed witnessed ledger (per-bot signing keys, two
local witness keys, roster, per-bot anchors, ledger.json written last).
It is idempotent, never replaces a mismatched or exposed key, and
--check verifies every ledger file without changing anything.

tools/cstack_mcp.py now exits 2 before creating any state when Cstack is
not set up, naming the init command; --allow-memory-ledger keeps the
memory ledger for tests and throwaway development. A test fails if the
generated bot profiles ever emit that flag.

The device name comes from --device, the name init recorded, or the
tailnet name, so Tailscale is optional. cryptography moves into
requirements.txt because the witnessed ledger is now the default.

Requirements CS-REQ-084, CS-REQ-085, CS-REQ-086; design SDD-C28 (and
SDD-C15 for CS-REQ-085).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cstack and others added 2 commits November 17, 2026 00:20
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#84 (now on main) imported tailnet_hostname from tools/cstack_mcp.py, which
this branch replaces with adapters.local_setup.resolve_device and
require_durable. Use the same flow in tools/foundations_mcp.py: refuse to
start without the durable ledger unless --allow-memory-ledger is given, and
take the device from --device, the recorded name, or the tailnet. Its launcher
tests pass --allow-memory-ledger, and a new test checks the refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Akilleez-QA
Akilleez-QA marked this pull request as ready for review November 17, 2026 06:41
@Akilleez-QA
Akilleez-QA merged commit 67f2d01 into main Nov 17, 2026
2 checks passed
Akilleez-QA pushed a commit that referenced this pull request Nov 17, 2026
Brings in #84 (Foundations MCP server) and #85 (cstack init, durable
ledger required in agent mode). Conflicts in CHANGELOG.md,
docs/architecture/architecture.md and docs/guides/how-to/define-bots.md
resolved by keeping both sides' entries; EXPORT-MANIFEST.json
regenerated with tools/build_export_manifest.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Akilleez-QA pushed a commit that referenced this pull request Nov 17, 2026
#85 added test_generated_bot_profiles_never_allow_the_memory_ledger
against the old agent_profiles.build(fleet, root, uv, state_root). This
branch replaced that with build(repo, target) -> (files, problems), so
the test raised TypeError after merging main. The test now checks every
generated subagent for every target, plus server_args and cstack_server,
for --allow-memory-ledger. No generator behaviour changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Akilleez-QA added a commit that referenced this pull request Nov 17, 2026
* Add the starter agent organization and a Claude Code subagent generator

Nine named starter agents (Chief, Scribe, Oracle, Sage, Smith, Warden,
Lab, Keeper, Archivist) in an engine-neutral definition format
(contracts/agent.schema.json), each with an AOR in aors/fleet.json, a
single-writer hand-off table and concurrency policy (agents/org.json),
shared expert practice (agents/PRACTICE.md) and six generic area-of-life
templates.

tools/agent_profiles.py now writes Claude Code project subagents to
.claude/agents/ with tools, permissionMode, mcpServers and a PreToolUse
guard hook (tools/agent_guard.py) derived from each AOR, so effects hold
outside MCP. --check fails on drift, undeclared fields and targets that
would drop wiring (plugins). The unread .agent/ output and mcpInheritance
are removed.

POODO's twenty-option rule is fixed in every definition (options 20,
research gate required); only research and red-team effort varies.
tools/check_options.py rejects options records without twenty options,
missing kinds, shared mechanisms or near-duplicates.

CS-REQ-080 to CS-REQ-083, SDD-C26.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port the no-memory-ledger profile check to the new generator API

#85 added test_generated_bot_profiles_never_allow_the_memory_ledger
against the old agent_profiles.build(fleet, root, uv, state_root). This
branch replaced that with build(repo, target) -> (files, problems), so
the test raised TypeError after merging main. The test now checks every
generated subagent for every target, plus server_args and cstack_server,
for --allow-memory-ledger. No generator behaviour changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Cstack <cstack@Cstacks-Mac-Mini.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Akilleez-QA pushed a commit that referenced this pull request Nov 17, 2026
Brings in #84 (Foundations MCP server), #85 (cstack init) and #86
(starter agents). Conflicts in docs/architecture/architecture.md and
docs/requirements/requirements.md resolved by keeping both sides:
component rows in SDD order (C26, C28, C29, C31) and requirements
CS-REQ-084 to CS-REQ-086 before CS-REQ-087. EXPORT-MANIFEST.json
regenerated with tools/build_export_manifest.py; data dictionary
--check passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant