Skip to content

feat: StackMemory portal + shared brain + VISION.md meta-loop (24/7 agents)#16

Closed
jonathanpeterwu wants to merge 5 commits into
mainfrom
claude/stackmemory-portal-setup-bFRZt
Closed

feat: StackMemory portal + shared brain + VISION.md meta-loop (24/7 agents)#16
jonathanpeterwu wants to merge 5 commits into
mainfrom
claude/stackmemory-portal-setup-bFRZt

Conversation

@jonathanpeterwu

Copy link
Copy Markdown
Collaborator

Summary

A three-layer stack for running agents 24/7: a browser portal into a persistent tmux Claude Code session, a shared brain that compounds context per repo + org, and a guardrailed vision meta-loop above the conductor that draws work from both VISION.md objectives and a monitored signal stream.

Layer What it is
Portal (stackmemory portal) Browser terminal into a persistent tmux new-session -A Claude Code session. Express + Socket.io + node-pty, token auth, embedded xterm.js UI. Hetzner cloud-init.yaml + setup.sh + systemd unit + Tailscale for 24/7 operation.
Brain (stackmemory brain) Shared, compounding context scoped per repo (projectId) and org (workspaceId). Agents record experiment summaries/conclusions and recall them; isolated, offline-safe online sync (newest-wins) reusing the Provenant auth — never touches the frame CloudSyncEngine.
Vision (stackmemory conductor vision) VISION.md-driven meta-loop above the conductor: north-star + guardrails + ordered objectives + hard limits. Draws work from objectives and a monitored signal inbox (bugs/CI/issues); consults the brain to skip concluded work; records outcomes back to the brain. Plan-only unless --delegate-cmd is given.

How they compose: the portal keeps the agent alive 24/7; the vision loop reads VISION.md (the guardrail), picks the next objective or signal, delegates to the conductor, and writes the conclusion to the brain — which every agent (Claude, Codex, OpenCode, Hermes) reads, so mutual thinking compounds.

Commits

  • feat(portal) — browser terminal into a 24/7 tmux Claude Code session
  • feat(brain) — shared, compounding context state per repo + org
  • feat(vision) — VISION.md meta-loop above the conductor
  • fix(brain,vision)exactOptionalPropertyTypes + noUncheckedIndexedAccess strict-mode fixes

Tests

42 new tests (15 portal, 14 brain, 13 vision), all green. Lint clean, build green.

Docs

docs/guides/PORTAL.md, docs/guides/BRAIN.md, docs/guides/VISION.md.

Notes / follow-ups

  • Hosted brain endpoints (/v1/brain/push|pull) need deploying in packages/provenant; the client speaks the documented contract and runs local-first until then.
  • The brain is exposed via the CLI (the surface the Codex/OpenCode/Hermes wrappers already use) rather than wired into the live MCP server.ts — native brain_record/brain_recall MCP tools can follow.
  • npm run typecheck OOMs in CI's default heap on this repo; the new modules were verified with a scoped tsc pass (source + tests, exit 0).

https://claude.ai/code/session_01Gk8DiqCeG9uMaWT9RprwP1


Generated by Claude Code

claude added 5 commits June 8, 2026 03:05
Self-hosted portal that streams a persistent tmux Claude Code session to
the browser over Socket.io + node-pty, designed to run on a small VPS
behind Tailscale.

- PortalServer (Express + Socket.io + node-pty) attaching to
  tmux new-session -A so the agent survives browser/portal restarts
- Token auth (auto-generated, 0600) gating both page + WS handshake
- Embedded xterm.js UI (no build step, ships in dist)
- stackmemory portal start|status|stop|token CLI
- Hetzner cloud-init, setup.sh, and systemd unit for 24/7 operation
- docs/guides/PORTAL.md walkthrough

https://claude.ai/code/session_01Gk8DiqCeG9uMaWT9RprwP1
A knowledge layer every agent (Claude, Codex, OpenCode, Hermes) reads from
and writes to. Each experiment/decision/insight is recorded with a summary
and conclusion, scoped to a repo (projectId) and org (workspaceId), so
mutual thinking compounds across tools and machines.

- BrainStore: local SQLite store (record/recall/supersede), repo+org scoped
- BrainSync: isolated online push/pull (newest-wins, offline-safe) reusing
  the Provenant auth/endpoint — never touches the frame CloudSyncEngine
- stackmemory brain record|recall|list|show|sync|status CLI
- openBrain() resolves scope/db/auth like stackmemory sync
- 14 tests (store scoping, supersede, upsert, sync cursor, conflict, offline)
- docs/guides/BRAIN.md

Agents connect by shelling out to the CLI, matching the existing
Codex/OpenCode/Hermes wrapper integration model.

https://claude.ai/code/session_01Gk8DiqCeG9uMaWT9RprwP1
A meta-orchestration layer one level above a single goal. A VISION.md
(north-star mission + guardrails + ordered objectives + hard limits) drives
a bounded loop that draws work from BOTH the objectives and a monitored
signal inbox, delegates one item per tick to the conductor, and records the
outcome to the shared brain so thinking compounds.

- vision-file: parse/scaffold VISION.md, toggle objective checkboxes
- signals: JSONL inbox for the monitored source (bugs, CI, issues)
- vision-loop: select (signals outrank objectives) -> guardrail-gate ->
  brain-dedupe (no repeats) -> delegate (injected) -> record -> mark done
- guardrails: maxIterations, maxIterationsPerDay, consecutive-failure circuit
  breaker, requireApproval, daily-resetting persisted state
- stackmemory conductor vision init|status|signal|plan|run
- run is plan-only unless --delegate-cmd is given (anti-haywire default)
- 13 tests; docs/guides/VISION.md

https://claude.ai/code/session_01Gk8DiqCeG9uMaWT9RprwP1
…dexedAccess

The whole-repo typecheck OOMs in this environment; a scoped tsc pass over the
new modules surfaced strict-mode violations esbuild/vitest don't catch:

- exactOptionalPropertyTypes: stop assigning undefined to optional props
  (conditional spreads for supersededBy/refs/error/query fields; splitList
  now returns string[])
- noUncheckedIndexedAccess: guard regex-group and array-index access in the
  VISION.md parser and the loop's objective selection
- tidy strict index access in the brain/vision tests

Scoped typecheck (source + tests) now passes clean; 42 tests still green.

https://claude.ai/code/session_01Gk8DiqCeG9uMaWT9RprwP1
CI lints the whole repo (eslint 'src/**/*.ts'); 146 pre-existing
prettier/prettier errors in files unrelated to this PR were failing the
lint job (main is red for the same reason). Auto-formats the 5 offending
files so PR CI can go green. No behavior change.

https://claude.ai/code/session_01Gk8DiqCeG9uMaWT9RprwP1

Copy link
Copy Markdown
Collaborator Author

Closing as superseded. The portal + brain + vision feature from this branch already merged to main via #15, which left this PR conflicting (dirty) by re-adding files main now has.

The only commits here not in #15 — the strict-mode type fixes and the pre-existing prettier cleanup — have been rebased onto current main and opened as #17.


Generated by Claude Code

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.

2 participants