Phases 1–2 of the project-management stack (design record:
doc/2026-10-24T11-05-38Z_design_project-management-stack/).
This directory is the complete deployment definition. Everything lives
in this repository; the only pieces that may ever live elsewhere are
forks of upstream projects.
| Piece | Image | Notes |
|---|---|---|
| Kaneo | ghcr.io/usekaneo/kaneo:2.47.0 + digest |
Web UI + API on container port 5173, bound to host 127.0.0.1:5173 only |
| PostgreSQL | postgres:16-alpine + digest |
Kaneo's database; named volume pm-stack_postgres_data; never exposed on a host port |
Phase 2 (2026-10-24) added three layers, each in its own subdirectory with the same deploy shape (SOPS → mode-600 env → compose/unit → health gate):
| Layer | Piece | Version / pin | Reach | Deployment definition |
|---|---|---|---|---|
| Dispatch | ready-for-agent | npm [email protected] (no container image exists upstream) |
UI + GraphQL on 6056, loopback + tailnet (app loopback-only; tailnet via socket proxy, #1181) |
ready-for-agent/ |
| Planning | Pad | ghcr.io/perpetualsoftware/pad:0.18.1, pinned by digest |
127.0.0.1:7777 + host tailnet address (PM_STACK_TAILNET_IP):7777; no tunnel hostname |
pad/ |
| Tables | Grist | gristlabs/grist-oss:v1.7.21, pinned by digest |
127.0.0.1:8484 + host tailnet address (PM_STACK_TAILNET_IP):8484; no tunnel hostname |
grist/ |
| Dashboard | Aggregator | this repo (Bun app, user unit pm-aggregator) |
127.0.0.1:4870 + tailnet amd-6.raptor-pumpkinseed.ts.net:4870; no public route |
aggregator/ |
| Intake | pm-dispatch | this repo (Bun app, user unit pm-dispatch) |
127.0.0.1:4879 + tailnet; public via tunnel as dispatch.security.cab |
dispatch/ |
| Console | pm-console | this repo (Bun app, user unit pm-console) |
127.0.0.1:4872; public behind sign-in as pm.security.cab (console at /console, dashboard at / through the console's gate) |
console/ |
ready-for-agent runs as a systemd user unit (like pm-tunnel)
because upstream ships only an npm package; Pad and Grist run as
containers per the standing container rule. Grist was chosen over
Baserow — the evaluation is in the design record.
Numeric environment variables are boot-time arguments, not strings to coerce. Every pm-stack service parses them the same way:
- Spelling: decimal digits only (
^[0-9]+$).12abc,1.5,0x10,+7, whitespace,NaNand empty are invalid — noparseInttruncation, noNumber()coercion. - Kinds and ranges: port
1–65535; milliseconds1–2147483647(2³¹−1, thesetTimeoutlimit); count/minutes≥ 1; ids positive. - Boot failure: an invalid value stops the process at startup with the variable name and the offending value in the message. Services never fall back silently on a malformed value; an unset variable still takes the documented default.
- Exemptions must be named: test-only variables (e.g. the id e2e
TEST_PORT), systemd protocol variables (LISTEN_FDS/LISTEN_PID, read with an integer guard and a safe fallback), and incident-replay hooks (OPENCODE_ROUTE_PROXY_NOW_MS) are not service configuration and do not use this parser.
The bin/ family states the same contract in
bin/proxy-port.mjs and parses through its
helpers (parseProxyPort, parseProxyMillis).
Capability provenance: the tables in this README are deployment
definitions (what the stack configures), not observed runtime. The
single per-facet matrix — live source, fallback, and deployment
status for every aggregator facet, naming the comment projector and
Pad honestly — is the "Capability provenance matrix" in
aggregator/README.md, kept in step with the
code and the NixOS module by
aggregator/scripts/check-provenance-matrix.ts. One consequence
worth stating here: the aggregator reads no Pad data — Pad is the
planning layer only.
Public address: https://kaneo.security.cab — a Cloudflare Tunnel
(tunnel name amd-6-pm-stack, remotely managed) whose ingress maps
that hostname to http://localhost:5173. The tunnel connector runs as
the pm-tunnel systemd user unit (see systemd/pm-tunnel.service);
the same tunnel also maps dispatch.security.cab to
http://localhost:4879 (pm-dispatch, added 2026-10-30). On amd, one
nixos-rebuild switch deploys the whole stack: the user units
(pm-aggregator, pm-projector, pm-dispatch, pm-tunnel) and the
Kaneo stack's lifecycle are declared in
../nixos/services/pm-stack.
The tunnel has to exist before the GitHub App can be registered,
because the app's webhook URL is
https://kaneo.security.cab/api/github-integration/webhook.
Current host: the Framework laptop (amd-6). Host specifics are
isolated in deploy.sh (two env vars) and the systemd unit paths;
everything else is host-independent so the stack can move to the
Kubernetes cluster later (the same values map onto a Secret + the
upstream Helm chart's env).
The sandbox is for Muse sessions, SSH, and web browsing only. It is not a
PM-stack host: do not start or enable servers, proxies, containers, or
service timers there. PM-stack services and the fleet-feed collector run
on the laptop host amd; the old sandbox kill-collector timer has been
retired, and its script refuses to run unless hostname -s is amd.
To align a sandbox checkout with the laptop's repository source, preserve
local work and fast-forward from origin/main (never reset or force a
checkout):
cd ~/git/code
git status --short --branch
git fetch origin
git switch main
git merge --ff-only origin/main
git rev-parse HEADCompare that commit with the laptop's git -C ~/git/code rev-parse HEAD
using ~/tools/laptop-ssh.sh. If the checkout has local changes or
cannot fast-forward, stop and preserve them for reconciliation; do not
reset it. Refresh repo-managed configuration from the aligned checkout,
but keep runtime deployment on the laptop: do not run deploy.sh, an
install.sh, nixos-rebuild, or any systemctl enable/start command on
the sandbox. Keep copied configuration source-aligned; do not copy
runtime state or rendered secret files as part of this alignment step.
The org Project Developing Today (#4) is the portfolio map; issues and their native GitHub relations remain the work record. For items in its pool:
- Project
Kind=Epicis canonical. The aggregator reads this field and resolvesepicRefthrough native sub-issue parents; it does not infer epic membership from labels. The GitHubepiclabel is the maintained gate and mirror: every pool item withKind=Epiccarriesepic, and no other pool item does. When adding a new epic, set both consistently. meta/epicis retired. It has no consumer and must not be used as an epic marker. Remove it rather than treating it as an alias. Keep the separateepiclabel where the Project auto-add gate needs it.- Hierarchy and dependencies are different edges. Native sub-issue
parents establish epic membership; native
blockedBy/blockingrelations express dependencies. Prose descriptions are not a substitute for either. - The orchestrator is the Project's single writer. Agents and the dashboard do not edit Project fields directly; the aggregator reads the pool through the fleet feed.
This repository copy records the reconciled convention from #1265 because the private Project README is not readable with the fleet's current GitHub scope. Source/design records: #910, #1122, and #1265.
All secrets live in ../secrets/pm-stack.sops.yaml
(SOPS/age, recipients: laptop + sandbox — see the path rule in
../.sops.yaml). Keys: postgres_password, auth_secret,
notification_secret_encryption_key, kaneo_admin_email,
kaneo_admin_password, github_app_id, github_app_name,
github_webhook_secret, github_private_key_base64,
cloudflare_tunnel_token — plus the Phase 2 additions:
pad_api_key, pad_admin_email, pad_admin_password,
pad_api_token, grist_session_secret, grist_admin_password,
grist_api_key, grist_boot_key — plus the pm-dispatch Supabase
additions: supabase_url, supabase_service_role_key (fleet
Supabase is muse-dev2; Bitwarden source:
supabase.muse-dev2.service-role-key). The same values are also filed in
Bitwarden and 1Password under the names recorded in the design
record (Bitwarden/1Password names use dots, e.g. pad.api-token,
grist.boot-key).
deploy.sh decrypts that file on the host and renders two mode-600
files beside compose.yml:
.env— consumed by both containers (see.env.examplefor the shape and the SOPS→env mapping);tunnel.env— the tunnel token for thepm-tunnelunit.
Never commit .env/tunnel.env; never hand-edit them (re-render
instead). Changing AUTH_SECRET signs everyone out; changing
POSTGRES_PASSWORD after first initialisation breaks the database
login until the database password is changed to match.
# 1. Check out this repo (or copy this directory + ../secrets) and cd in
cd pm-stack
# 2. Render env and start the stack (waits for the health endpoint)
./deploy.sh
# 3. Install + start the tunnel connector
install -Dm644 systemd/pm-tunnel.service ~/.config/systemd/user/pm-tunnel.service
systemctl --user daemon-reload
systemctl --user enable --now pm-tunnel.service
# 4. Verify
curl --fail http://127.0.0.1:5173/api/health
curl --fail https://kaneo.security.cab/api/healthRegistration renders closed by default — a re-render must never silently reopen it (it did once, 2026-10-24; see the design record's Phase 1 as-built correction). To bootstrap the first account, render once with the explicit opt-out, create the account, then render again to close:
# 1. One render with registration open
KANEO_OPEN_REGISTRATION=1 ./deploy.sh
# 2. Create the admin account (the kaneo_admin_* credentials in
# SOPS) via the sign-up page — or, equivalently,
# POST /api/auth/sign-up/email
# 3. Close registration again (renders DISABLE_REGISTRATION=true and
# recreates the container)
./deploy.shThen create a workspace and the first project from the UI or the API.
Kaneo syncs through a GitHub App that we register (one app serves the whole instance; install it per repository). Registration is a one-time browser step because GitHub offers no API for it:
- Signed in as a
developing-todayorg owner, use the app-manifest flow withgithub-app-manifest.json: POST it as themanifestfield tohttps://github.com/organizations/developing-today/settings/apps/new. The manifest requests exactly the permissions Kaneo documents — Issues: read/write; Pull requests, Contents, Metadata: read; events Issues, Issue comments, Pull requests, Push — and sets the webhook URL above. - GitHub redirects to
https://kaneo.security.cab/?code=…. Exchange the code within the hour:POST https://api.github.com/app-manifests/{code}/conversionsreturns the App ID, slug, PEM private key, and webhook secret. - Put those four values into
secrets/pm-stack.sops.yaml(github_app_id,github_app_name,github_webhook_secret,github_private_key_base64= base64 of the PEM), re-encrypt (sops -e -i), file copies in Bitwarden + 1Password, then re-run./deploy.shon the host. - Install the app on the repositories to sync (GitHub → org settings →
GitHub Apps → Install App; Phase 1:
developing-today/codeonly). Adding a repository to an installation cannot be done with the app's own credentials — the REST endpoint needs an org owner's (or, for a personal account, the account owner's) GitHub session, so this step stays a browser step. - In Kaneo: create/open the project → Settings → Integrations →
GitHub → connect the repository, then Import issues.
(API equivalents:
POST /api/github-integration/verify,POST /api/github-integration/project/{projectId},POST /api/github-integration/import-issues.) The projects, their repositories, and their installations are registered inkaneo-projects.json; once the app is installed on a repository,./connect-repo.sh connect <slug>performs verify → connect → import (resuming until done) and prints the GitHub open-issue count next to the Kaneo task, issue link, and not-in-Done counts../connect-repo.sh statusreports the same for every project without changing anything.
What syncs (verified against Kaneo v2.47.0): issues ↔ tasks, comments
(create-only; edits/deletes do not sync), open/close both ways,
status:*/priority:* labels both ways, title/body edits. PRs are
read-only to Kaneo — they only move tasks (push → in-progress, PR
opened → in-review, merged → in-review). A merge must never move a
task to Done by itself: until 2026-11-14 pr_merged mapped to Done,
which made the two-way close sync close GitHub issues that a merged
PR merely referenced (defect #7610). The rule, why, and how to
re-apply it after a re-connect live in
KANEO-GITHUB-SYNC.md. Bot-authored comments are not
imported inbound. Each Kaneo project connects to exactly one
repository (upstream issue usekaneo/kaneo#791).
cd ready-for-agent
./install.sh # pinned npm package + user unit + health gate
./install.sh clone # one-time: clone the repos it serves into ./repos/- Register + configure repos declaratively (#1203):
ready-for-agent/config.jsonnames every served repository (clone URL, local dir,mergePolicy,defaultModel,includeAllIssueAuthors, paused)../install.sh cloneclones/fetches them all intoready-for-agent/repos/, and every./install.shrun finishes by applying the config through the harness's GraphQL API viaready-for-agent/apply-config.sh(addLocalRepository for unregistered clones, a full-object updateRepositorySettings built from the live settings with only the config-owned fields overridden, pause/unpause to match; a converged harness receives no mutations, so re-runs are no-ops;DRY_RUN=1 ./apply-config.shpreviews). Fleet posture:mergePolicy: OFF(human merge) on every repo. Do not use theready-for-agent addCLI from an interactive SSH shell on this host - its in-process git inspection returnsNOT_A_GIT_REPOSITORYfor valid repos there (it succeeds from the service's clean environment, which is what GraphQL uses). A repo with no build model set refuses Implement ("No build model set") - the config'sdefaultModelis what prevents that. - Dispatch: label an issue
ready-for-agent, then Implement from the UI, via GraphQLimplementNow(repositoryId, nativeId: "<issue number>"), or via the CLIready-for-agent intake <owner/repo>(starts all current candidates — use with care). The harness creates a worktree under/tmp/ready-for-agent/<owner>/<repo>/…, runs the host's OpenCode 2, and opens a PR. GitHub auth is the host'sghlogin. - Never enable auto-merge. "Implement With" and "Implement All with Auto-merge" write per-item merge-policy pins; the fleet posture is human merge, always.
- Status:
ready-for-agent status developing-today/code; backend health is theagentBackendStatusesGraphQL query (OpenCode should readkind: READY).
cd pad
./deploy.sh # SOPS -> .env, compose up, health gate on /api/v1/health
./seed.sh # idempotent REST seed of the Plan items in seed/- Health:
GET http://127.0.0.1:7777/api/v1/health→{"status":"ok",…}. (/healthzonly hits the SPA fallback.) - Bootstrap (first time only):
pad initmust run inside the server container (docker compose exec pad pad init) — bootstrap is loopback/token-gated (token at/data/.bootstrap-token). Create the admin from thepad_admin_*SOPS credentials and the workspace Developing Today; the startup template creates the tasks, ideas, plans, docs, conventions, and playbooks collections. - API automation: REST uses minted user tokens (
pad_prefix, Bearer). ThePAD_API_KEYenv var is inert on 0.18.1. Mint a token namedpm-stack-automation(scopes*) and file it aspad_api_token. Tokens expire after 90 days (the current one on 2027-01-22) — re-mint and re-file in SOPS + Bitwarden + 1Password before expiry. - Seed content lives in
seed/*.md; the seed talks to workspace-scoped REST routes (/api/v1/workspaces/developing-today/collections/plans/items) and skips items that already exist.
cd grist
./deploy.sh # SOPS -> .env, compose up, health gate
./seed.sh # idempotent seed: workspace, doc, Roadmap table + rows- Bootstrap (first time only): the boot-key flow —
POST /boot/login {bootKey, adminEmail}. The boot key lives in the home DB because the container writes no logs: copy/persist/home.sqlite3out of the volume and readactivations.prefs→envVars.GRIST_BOOT_KEY. It is filed asgrist_boot_key. The admin (grist_admin_*) is the install admin. - API key:
POST /api/profile/apiKeyas the admin returns a raw key; file it asgrist_api_key. The key is all-or-nothing for its user — the dedicated admin account is the mitigation. - API quirks (1.7.21):
POST /api/docs/{id}/applytakes the bare UserAction array as the body; create-workspace/doc endpoints return bare ids; there is noGET /api/workspaces/{id}/docs(docs ride inside the org's workspace list). - Seeded content: workspace Roadmap & registers, document
Program roadmap, table Roadmap, rows from
seed/roadmap.json(the PM-stack phases, the cluster register headlines, the four-repo fleet). - Choice-list edits: use
grist/update-choice-options.py(REST columns PATCH, verified on v1.7.21 under the roadmap ACL) — never/applyUpdateColumn(blocked by access rules) and never the document SQLite. Runbook:grist/CHOICE-OPTIONS.md(#1287).
Grist OSS v1.7.21 provides the authenticated
POST /api/docs/{docId}/force-reload endpoint. It closes and reopens
the document inside the running Grist service; it does not restart the
container. After an approved external document edit, verify the exact
cell through the API while forcing the reload:
cd grist # from pm-stack/
./reload-doc.sh DOC_ID TABLE_ID ROW_ID COLUMN_ID EXPECTED_VALUEThe script reads grist_api_key from the same SOPS file and age key as
seed.sh, sends the reload request, and exits non-zero if the selected
cell does not read back with the expected text. It does not print the
API key. For a simple API-supported text update that should be applied
as part of the operation, append --apply; the script uses one
UpdateRecord action, skips the write when the value is already equal,
then force-reloads and verifies. Do not use --apply for schema
changes or arbitrary actions.
Before a live edit, choose a reversible, low-impact cell change and
record its original value and restoration step. Check that no one is
actively editing the document; Grist may reject the reload while a
write is in progress. Inspect the aggregator's roadmap source chip or
/api/health (source.roadmap) before, during, and after the operation:
live (Grist...) means it is reading from Grist, while a
fixtures (...) value explicitly signals fallback. If the roadmap
source changes unexpectedly, stop and investigate rather than treating
the fallback as live data. Confirm the container's StartedAt is
unchanged to distinguish a document reload from a service restart.
Direct SQLite editing is not the routine workflow; this wrapper only
uses the Grist API.
- Status:
docker compose ps,docker compose logs -f kaneo,systemctl --user status pm-tunnel. Phase 2 pieces:docker compose -f pad/compose.yml ps,curl --fail http://127.0.0.1:7777/api/v1/health(Pad),docker compose -f grist/compose.yml ps(Grist),systemctl --user status ready-for-agent+ready-for-agent status developing-today/code(dispatch). - Restart with current env:
./deploy.sh restart. Environment changes require./deploy.sh(compose applies env on recreate, not restart). Each Phase 2 subdirectory has the samedeploy.shcontract (Pad, Grist); ready-for-agent refreshes viaready-for-agent/install.sh. - Update Kaneo or PostgreSQL: after reviewing the upstream release
notes, bump the tag and digest together in
compose.yml, then./deploy.sh. Never float on a mutable tag. Same rule per component: Pad/Grist image pins (tag + digest) in theircompose.yml, ready-for-agent'sPINNED_VERSIONinready-for-agent/install.sh. - Pad API token: expires 90 days after minting (current: 2027-01-22) — re-mint, re-file (SOPS + both vaults), restart nothing (the token is used by external automation, not the container).
- Backups:
docker compose exec postgres pg_dump -U kaneo kaneointo the host's normal backup path; the SOPS file + this directory are the rest of the restore story. Pad's data is the named volumepad_pad_data; a Grist document backs up as its.gristfile (SQLite) under the volume's/persist/docs, plushome.sqlite3for the install itself. - Move hosts: copy this directory +
../secrets, ensure the new host's age key is a SOPS recipient, run./deploy.sh, install the unit, done. Pad and Grist pick up the new host's tailnet address at render time (deploy.shwritesPM_STACK_TAILNET_IPfromtailscale ip -4; set it in the environment to override, and with no tailnet address both bind loopback only). The tunnel is host-agnostic (token-based); only one connector should run at a time.
pm-stack/
├── README.md # this runbook
├── compose.yml # pinned Kaneo 2.47.0 + PostgreSQL 16
├── .env.example # configuration shape (no real values)
├── deploy.sh # SOPS -> .env/tunnel.env, compose up, health gate
├── github-app-manifest.json # one-time GitHub App registration
├── kaneo-projects.json # projects <-> repositories <-> installations
├── connect-repo.sh # status | connect <slug>: verify, link, import
├── systemd/
│ └── pm-tunnel.service # Cloudflare Tunnel connector (user unit)
├── pad/ # Phase 2 planning layer (Pad 0.18.1)
│ ├── compose.yml # pinned image + digest, loopback + tailnet
│ ├── deploy.sh # same deploy contract as the top level
│ ├── .env.example
│ ├── seed.sh # idempotent REST seed
│ └── seed/ # Plan item content (Markdown)
├── grist/ # Phase 2 table layer (Grist 1.7.21)
│ ├── compose.yml # pinned grist-oss image + digest
│ ├── deploy.sh
│ ├── .env.example
│ ├── seed.sh # idempotent seed via the REST API
│ ├── reload-doc.sh # force-reload + API read-back verification
│ └── seed/roadmap.json # Roadmap rows
└── ready-for-agent/ # Phase 2 dispatch layer (ready-for-agent 1.1.0)
├── install.sh # pinned npm install + unit + clone helper
└── systemd/
└── ready-for-agent.service