diff --git a/resume-prompt.md b/resume-prompt.md new file mode 100644 index 0000000..c5616c7 --- /dev/null +++ b/resume-prompt.md @@ -0,0 +1,234 @@ +# Resume Prompt — Agent Identity Provisioning (Session 2) + +> **Read this entire file before doing anything.** This is a handoff from session 1 which got bogged down in failed Playwright selector iterations. Start fresh with a methodical approach. + +--- + +## Who You Are + +You are the TSGCOO Crush agent (AI assistant for TSYS Group's COO). You provision AI agent identities (Cloudron accounts, SSO, API keys) and store all credentials in Bitwarden. + +## Governance Rules (from TSYSGroupAIOS/BASELINE-PROMPT.md) + +Read `/home/TSGCOO/projects/TSYSGroupAIOS/BASELINE-PROMPT.md` and `/home/TSGCOO/projects/TSYSGroupAIOS/AGENTS.md` before starting. + +Key rules: +- **Docker for everything** — no language toolchains on the host. The ONLY exception: the `bw` wrapper at `~/.local/bin/bw` which invokes Docker. +- **No secrets on disk except BW access info** — everything in `~/.config/bw/env` (single-quoted values, perms 600). +- **Atomic commits, conventional style** — `feat:`, `fix:`, `docs:` etc. Commit often. +- **Develop on master** — push when work is complete. +- **30s timeouts for reads, 120s standard, 300s deployments.** +- **Container naming**: always `tsys-` prefix. Pin all images (no `:latest`). +- **Status.md and JOURNAL.md** must be maintained. +- **Redmine** is the system of record for work tracking (exempted during bootstrap phase). +- **The `todos` tool is OK** for tactical work within a single task. Redmine is for durable cross-agent tracking. +- **Never delete credentials.** The `BitwardenHelper` class has no `delete_item` method by design. Manual deletion via host `bw` CLI is allowed for human-directed operations only. + +--- + +## What's Already Built and Working + +### Bitwarden CLI Infrastructure (SOLID — do not rewrite) + +- **Host wrapper**: `~/.local/bin/bw` — invokes Docker container with full auth lifecycle +- **Container image**: `reachableceo-bw-native:2026.7.0` — debian-slim + pre-compiled bw binary +- **Dockerfile**: `/home/TSGCOO/org-buildout/docker/bw-native/Dockerfile` +- **Scripts**: `/home/TSGCOO/org-buildout/scripts/bw-cli.sh`, `bw-entrypoint.sh`, `bw-install.sh` +- **All scripts pass shellcheck** (zero warnings including info-level) +- **BW server**: `https://pwvault.turnsys.com` (self-hosted Vaultwarden) +- **BW account**: `coo@turnsys.com` + +The host `bw` wrapper works reliably. Test it: `bw status`, `bw list items`, `bw generate -ulns --length 24`. + +**IMPORTANT**: The "native Rust binary" from Bitwarden's GitHub releases is actually a Node.js SEA (Single Executable Application) — it's Node.js packaged as a single binary. It still prints Node.js errors on crash. The user wanted zero Node.js for CMMC/ITAR compliance. This is a **known issue** that needs to be discussed with Charles. The BW MCP server container (`kneldevstack-aimiddleware-bitwarden-mcp-crush`) is also available but needs wiring into Crush config. + +### Bitwarden Credential File + +`~/.config/bw/env` — all values MUST be single-quoted (password contains `$` chars): +``` +BW_CLIENTID='user.98954ef9-da68-42f2-bcf8-c2343202ea60' +BW_CLIENTSECRET='WCOTwi9TbLDwzFwKXiD8pcEQy1PY3r' +BW_PASSWORD='yZ6Qw$5h$vdPL9DxEXwxCO#^m0J%dS8@' +BW_TOTP_SECRET='VLEZH74VBECT2XLHWMSTS6R4QQ2SBXCJ' +BW_SERVER='https://pwvault.turnsys.com' +``` + +### Repos + +| Repo | Path | Status | +|---|---|---| +| `org-buildout` | `/home/TSGCOO/org-buildout` | BW infra committed, AGPLv3, can't push (no Gitea auth) | +| `agent-identity-provisioning` | `/home/TSGCOO/projects/agent-identity-provisioning` | Provisioner code, multiple commits, can't push | +| `TSYSGroupAIOS` | `/home/TSGCOO/projects/TSYSGroupAIOS` | Governance framework, clean (BW stuff was moved to org-buildout) | + +--- + +## Current BW Vault State + +``` +Items: 2 + 30b5c3d7-... - vp-techops Cloudron - totp=no (2FA NOT enabled) + b8de991b-... - vp-techops Gitea - totp=no +``` + +The vp-techops Cloudron account exists with a stored password. **2FA is NOT enabled** — this is a hard blocker for CMMC compliance. + +The vp-techops Gitea token was manually stored during session 1. The token `c0388aa0504bef4e4effdb47c910ef8f6252f5bd` was verified working via Gitea API (`user=vptechops`). + +--- + +## Current Provisioner State + +The provisioner container runs as non-root user `provision` (UID 997). It has a known **BW state sync issue** — the `bw-state/` bind mount gets out of sync between container runs. This MUST be fixed before any Playwright work matters. + +### Key Files + +- `provision-agent.py` — main Playwright automation (~850 lines, lots of debug dumps) +- `bw_helper.py` — BW CLI wrapper with safety guarantees (no delete, duplicate prevention, update in place) +- `agents.yaml` — manifest with real vp-techops invite link +- `Dockerfile` — Playwright base + native bw binary + python3-pip + non-root user +- `docker-compose.yml` — env_file for BW creds, bind mounts for state +- `test_bw_helper.py` — 10 credential lifecycle tests (tests 1-4 verified passing) + +--- + +## The SSO Pattern (Proven for Gitea) + +All Cloudron-managed apps use the same SSO pattern: + +1. **Login to Cloudron panel first** (`cloudron_panel_login()`) to establish OIDC session +2. **Navigate to app login page**, click SSO/OAuth button +3. **Cloudron OIDC handles auth** — may show login form (if session expired) or consent page +4. **Redirect back to app** authenticated + +### Cloudron UI Technical Details + +- Cloudron uses **Pankow/Vue** components +- Login form: `#inputUsername`, `#inputPassword`, `#inputTotp` (for 2FA) +- Submit button is `
Log in
` — NOT a `