# CyberBrain26 v4.1 — verified project status

**Updated:** 2026-10-02  
**Branch:** `master`  
**HEAD at review:** `90a42e6` (`chore: complete Audit B spaces and security tests`)  
**Version:** `4.1.0`

## Summary

CyberBrain26 is a tested Python prototype. The working tree now includes an
optional SQLite persistence slice for Ptah roadmap steps, approvals, audit,
project memory, and provenance. Legacy constructors remain in-memory by
default. Python and shell execution still uses the authorized Linux Bubblewrap
path. The project is not a release-ready baseline: the working tree is still
uncommitted and has not been formed into a release commit.

Local verification covered the current working tree. There are no staged changes
at this point, so there is no separate staged index to verify. Live
model-provider services were not called. CI is configured but its hosted
workflow has not yet run.

See [BASELINE_REVIEW.md](BASELINE_REVIEW.md),
[EXECUTION_SECURITY_REVIEW.md](EXECUTION_SECURITY_REVIEW.md),
[SQLite storage notes](docs/data/sqlite-storage.md), and the code-level
[security one-pager](docs/SECURITY_ONE_PAGER.md) for details.

## Roadmap position

| Roadmap phase | Verified state |
| --- | --- |
| 0 — Forensic audit | Older audit artifacts remain historical. `source-audit.txt` now records the current source areas and limits; the historical inventory was not revalidated. |
| 1 — Clean foundation | Package and tests exist, and repeatable CI is configured. The shared Git tree is still uncommitted, so a clean release baseline is open. |
| 2 — Control Plane | Event bus and callable queue remain in-memory. `SQLiteTaskQueue` adds durable named JSON jobs; Ptah roadmap steps use it when given a `SQLiteDatabase`. Distributed workers remain open. |
| 3 — Security Foundation | Identity, policy, permission, firewall, and quality gates exist. Approval and audit can persist to SQLite when configured; memory-only defaults remain supported. |
| 4 — Modular architecture | Provider contracts and in-memory registries/dispatcher exist. Durable registry and distributed implementations remain open. |
| 5 — Model Layer | Registries, routing, and LiteLLM/Ollama/llama.cpp clients exist. No live provider health checks were run. |
| 6 — Agent Layer | Built-in roles and Ptah orchestration are prototypes, not autonomous production agents. |
| 7 — Execution Layer | Authorized Python/shell execution through Bubblewrap is integrated. The product CLI sub-apps `cyberbrain approvals` and `cyberbrain doctor` are registered in the entry point (`cli.py:66-67`) and covered by `tests/test_product_cli.py`; `cyberbrain doctor` is a configuration self-report, not a security proof. `cyberbrain run` is fail-closed: every step routes through `AuthorizedExecutionService` over a SQLite-backed `PtahBridge` that carries identity, scope, policy, approval, tasks, and audit (decision D2), with no `--insecure-legacy` bypass; sensitive steps end closed with `ExecutionRefused`/`SecurityError`. See [docs/SECURITY_ONE_PAGER.md](docs/SECURITY_ONE_PAGER.md) and [docs/product/DECISIONS_LOG_V5.md](docs/product/DECISIONS_LOG_V5.md). Browser, Git, container/microVM and external runtime backends remain open. Bubblewrap is **not** approved for hostile code. |
| 8 — Data & Memory | SQLite migrations, durable tasks/approvals/audit, trust-labeled project memory, keyword retrieval, local provenance metadata, and explicit retention are implemented as a local prototype. ChromaDB, Notebook, and broader Knowledge Base workflows remain open. |
| 9 — AI Firewall & Privacy Gateway | The existing firewall remains. A local heuristic redaction gateway is connected to project-memory writes; broader output, MCP, egress, and pseudonymization controls remain open. `AIFirewall` is **not** wired into the execution path or into egress, and `PrivacyGateway` covers project-memory writes only — neither is a guard on `cyberbrain run` or on prompt egress. This gap is unchanged by the D2/D3 work recorded in [docs/product/DECISIONS_LOG_V5.md](docs/product/DECISIONS_LOG_V5.md); see [docs/SECURITY_ONE_PAGER.md](docs/SECURITY_ONE_PAGER.md) §5 and §10. |
| 10+ — Lab, research, product, governance, enterprise | Mostly unimplemented or placeholder areas. |

## Verification performed

- `PYTHONPATH=src python3 -m pytest -q`: **369 passed, 0 skipped**. Bubblewrap was
  available locally (`bwrap --version` -> `bubblewrap 0.9.0`), so the Linux
  execution smoke and selected isolation tests ran in this working copy.
- Bubblewrap genuinely unresolvable — the suite was re-run under `unshare -rm`
  with `/dev/null` bind-mounted over `/usr/bin/bwrap`, so `shutil.which("bwrap")`
  is `None` rather than mocked as absent:
  `PYTHONPATH=src python3 -m pytest -q -rs` -> **360 passed, 9 skipped**. All
  nine skips are `Bubblewrap is unavailable` (7 in
  `tests/test_execution_provider.py`, 2 in `tests/test_security_e2e.py`, 1 in
  `tests/test_cli_run_authorized.py`); nothing falls back to an unsandboxed path.
- `python3 -m ruff check .`: passed (`All checks passed!`).
- `PYTHONPATH=src python3 -m mypy --cache-dir=/tmp/cb26-final src/cyberbrain26`:
  `Success: no issues found in 57 source files`.
- `python3 --version`: `Python 3.12.3`.
- `git diff --check`: reports only three trailing-whitespace findings
  (`PROJECT_STATUS.md:3,5`, `docs/product/MVP_GAP_ANALYSIS_V5.md:4`). Those are
  deliberate Markdown hard line breaks matching the surrounding style, not
  stray whitespace; no other whitespace errors.
- Restart tests cover pending/completed SQLite jobs, explicit retry of an
  interrupted job, cross-manager approval visibility, audit correlation,
  online backup restore, trust filtering, provenance hash checks, and
  retention behavior.
- `.github/workflows/ci.yml` installs Bubblewrap, runs the full test suite,
  Ruff, and package-wide mypy. The `no-bubblewrap-fail-closed` job removes the
  `bwrap` binary, asserts non-resolvability three ways (`command -v bwrap`,
  `bwrap --version`, `shutil.which`), then asserts the provider refuses with
  "refusing to run code without a sandbox".
- **Still unverified:** whether that hosted CI job has ever actually run. Its
  result is known only from reading the workflow file, not from a green build.
  The Bubblewrap-absent path was, however, verified locally in this review using
  a real `unshare -rm` bind mount (see above), not only by mocking.

These checks do not constitute security certification. The Bubblewrap
limitations and required deployment hardening are recorded in
[EXECUTION_SECURITY_REVIEW.md](EXECUTION_SECURITY_REVIEW.md).

## Git state

As of this 2026-10-02 review, `git rev-parse HEAD` is
`90a42e6cee27a6233c9b6e7255f35a772bd4f9a2` with subject line
`chore: complete Audit B spaces and security tests`, and `git status --short`
reports **19 entries: 12 modified tracked files and 7 untracked paths**. This is
the actual output of that command as of this review, not a historical figure:

```
 M .github/workflows/ci.yml
 M PROJECT_STATUS.md
 M ROADMAP_V5.md
 M docs/product/MVP_GAP_ANALYSIS_V5.md
 M spaces_config.json
 M src/cyberbrain26/agents/orchestrator.py
 M src/cyberbrain26/cli.py
 M src/cyberbrain26/control_plane/__init__.py
 M src/cyberbrain26/control_plane/task_queue/__init__.py
 M src/cyberbrain26/execution_plane/__init__.py
 M src/cyberbrain26/execution_plane/secure_gateway.py
 M src/cyberbrain26/orchestration/ptah_bridge.py
?? SESSION_HANDOFF.md
?? docs/SECURITY_ONE_PAGER.md
?? docs/product/DECISIONS_LOG_V5.md
?? docs/research/
?? src/cyberbrain26/product/
?? tests/test_cli_run_authorized.py
?? tests/test_product_cli.py
```

The index is empty: there are no staged changes, only unstaged modifications and
untracked paths. No changes were staged, committed, reset, or deleted during
implementation or during this review. The tree is still not a clean release
baseline, and forming a release commit remains the owner's decision.

**Unreconciled conflict between documents.** Two other documents record
different Git-state counts for earlier snapshots and neither matches the 19
measured above:
[docs/presentations/CYBERBRAIN26_VYVOJ_STAV_2026-10-02.md:107](docs/presentations/CYBERBRAIN26_VYVOJ_STAV_2026-10-02.md)
claims 84 `git status` entries, and
[docs/product/WORKING_TREE_INVENTORY_V5.md:9](docs/product/WORKING_TREE_INVENTORY_V5.md)
claims 87 changed paths. Those are point-in-time observations of a different
tree state; this file reports only what was measured today and does not
reconcile them.

## Implemented behavior and limits

- Ptah uses SQLite task, approval, and audit storage only when configured with
  a shared `SQLiteDatabase`. Existing no-argument behavior remains in-memory.
- Durable jobs require a stable registered handler and JSON payload/result.
  Legacy callable queue entries are not durable. A job left running at startup
  becomes `interrupted`; the system will not replay it until an operator
  explicitly retries it after reviewing possible side effects.
- Approval requests are transactionally decided in SQLite and refresh across
  manager instances. Audit events persist with task IDs for correlation.
- Retention defaults to 90 days but is applied only by an explicit
  `SQLiteDatabase.prune_expired()` call. Pending approvals and unfinished tasks
  are retained. Logical deletion is not secure erasure.
- SQLite files are permission-restricted where supported but are not
  encrypted. Backups and WAL files need the same access controls.
- Project memory excludes `untrusted` entries by default. Trust labels are
  caller-provided origin/review metadata, not execution authorization. Common
  email, phone-like, and secret patterns are heuristically redacted before
  memory writes; the filter is not comprehensive PII detection.
- Local provenance stores a SHA-256 integrity digest and labels. It does not
  create signatures or modify/watermark source media.
- Bubblewrap mounts system runtime paths read-only and the chosen workspace
  writable, disables networking, applies per-process limits, and has no
  unsandboxed fallback. It lacks cgroup-wide memory/PID and workspace disk
  quotas, and is Linux-only.

## Recommended next work

**The owner is ending this work session.** Resuming context is in
[SESSION_HANDOFF.md](SESSION_HANDOFF.md), which is the authoritative handoff;
read it first. The two items previously listed as open here are now done:

- **DONE — Prove fail-closed in CI.** `no-bubblewrap-fail-closed` job in
  `.github/workflows/ci.yml` (`docs/SECURITY_ONE_PAGER.md:201`) removes `bwrap`
  and confirms `ExecutionRefused`/fail-closed. See `ROADMAP_V5.md:153`.
- **DONE — `cyberbrain run` wired through the authorized path** per decision D2:
  `AuthorizedExecutionService` with a SQLite-backed `PtahBridge`, so sensitive
  actions end closed with `ExecutionRefused`/`SecurityError` instead of a silent
  pass. No `--insecure-legacy` bypass. Decision D3 also removed
  `ModelGateway`/`--model`/`--lang` from the CLI. See
  [docs/product/DECISIONS_LOG_V5.md](docs/product/DECISIONS_LOG_V5.md).

What genuinely remains, in the owner's stated priority order:

1. **Blocking gate — customer discovery has not started.** 0 interviews, no
   outreach, and no contact list exists. Contacting anyone requires the owner's
   explicit instruction. This blocks every remaining product-scope decision,
   including the OS target (D1) and the first coding-agent entry point. Plan:
   [docs/product/CUSTOMER_DISCOVERY_V5.md](docs/product/CUSTOMER_DISCOVERY_V5.md).
2. **Packaging + CI for Ubuntu 24.04 LTS** per decision D1. Blocked on D1 but
   not on discovery. See
   [docs/product/DECISIONS_LOG_V5.md](docs/product/DECISIONS_LOG_V5.md).
3. **`plan --steps N` does not work.** `PlannerAgent.execute` ignores
   `max_steps` and always returns `range(1, 4)`. Fix lives in
   `agents/orchestrator.py`.
4. **`plan` writes a durable task row whose COMPLETED result is never
   refreshed,** so re-running `plan` with the same `--id` reuses a stale plan.
5. **`--scopes` applies only to the `coder` role.** A `security`/`evaluator`
   step carrying code passes the scope gate and is blocked later at the
   policy/approval layer. Documented, but it is a trap.
6. **Library loggers print full stack traces to stderr on every refused step**
   (`logger.exception` in `ptah_bridge.py` and the task queue). Suppressing this
   from the CLI would be a regression; it can only be fixed in
   `ptah_bridge.py`.
7. **Legacy durable job rows are permanently non-retryable by design.** A
   COMPLETED row written before this change carries `success=False` with no
   `execution_attempted` marker. Fail-closed was chosen deliberately; such rows
   must be recreated (new roadmap/step id) or removed manually.
8. **On approval timeout the database persists `cancelled` but the raised
   message says `Approval pending`** — `status` is computed from the object read
   before `cancel()` (`extension_layer/registry_impl.py:229-232`,
   `execution_plane/secure_gateway.py:209-222`). This is a misleading message,
   **not** a gate bypass: the step is still refused and nothing executes.
   Not fixed.
9. **`python3 -m cyberbrain26.cli` silently exits 0 and does nothing**, because
   there is no `__main__` guard in `cli.py`. Verified in this review.

### Still-open security gaps — none of these were closed

Do not read any of the work above as closing these. All remain open:

- Approval is **not** cryptographically bound to the code that executes.
- Prompt egress to remote providers is neither evidenced nor blocked.
- `AIFirewall` is not wired into the execution path or into egress.
- Missing cgroup-wide memory/PID limits and workspace disk/inode quotas.
- `chmod` on SQLite files is best-effort only.
- `SQLiteDatabase.prune_expired` is logical deletion, not secure erasure.
- `ACTION_SCOPE_MAP` is missing four actions.

Before any untrusted-code use, deployment-level cgroup and filesystem quotas,
descendant cleanup verification on the supported host, and an independent
security review of the complete deployment are still required. Bubblewrap is
**not** approved for hostile code, and this is **not** a release-ready baseline.

No commits or pushes were made.
