Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

AI Coding Base Setup

Cross-platform installer/updater for Claude Code, opencode, OpenAI Codex, and Cursor Agent configurations. Syncs the same set of MCPs across all four CLIs, plus shared Claude/Codex skills and workflow hooks, native plugins, and CLI-specific status UI. Runs on Mint Linux, WSL, Windows, and devcontainers (DevPod / Codespaces / Dev Containers).

Quick Start

git clone https://github.com/vossiman/aiCodingBaseSetup.git
cd aiCodingBaseSetup
./install.sh

On first run, you'll be prompted for API keys. Press Enter to skip any you don't have yet.

What Gets Installed

CLIs

The installer ensures four AI coding CLIs are present and configured:

CLI Binary Login Auth file persisted at
Claude Code claude claude (browser OAuth) ~/.claude/.credentials.json
opencode opencode opencode auth login <provider> ~/.local/share/opencode/auth.json
OpenAI Codex codex codex (first run — ChatGPT sign-in or OPENAI_API_KEY) ~/.codex/auth.json
Cursor Agent agent (or cursor-agent on older releases) agent login (or CURSOR_API_KEY) ~/.config/cursor/auth.json — install.sh symlinks ~/.config/cursor into the bind-mounted ~/.aicodingsetup/cursor-config so login is once-ever across pods (the mounted ~/.cursor holds only MCP config, not credentials)

All four read the same managed MCP servers; auth state persists across containers via bind-mounted home directories (DevPod setup — see "Devcontainers" below).

MCP Servers

Configured for all four CLIs: claude mcp add for Claude Code, ~/.config/opencode/opencode.json mcp field for opencode, ~/.codex/config.toml [mcp_servers.*] tables for Codex, and ~/.cursor/mcp.json mcpServers object for Cursor Agent. install.sh deploys each format from configs/.

MCP Purpose Auth
firecrawl Web scraping and content extraction API key
brave-search Web, news, image, video search API key
context7 Library documentation lookup (via Docker) None
playwright Browser automation, screenshots, testing None (via plugin)
kanban Shared backlog: hosted MCP at https://kanban.dataprospectors.at/mcp Bearer KANBAN_TOKEN

Kanban MCP lifecycle

The board serves its MCP at https://kanban.dataprospectors.at/mcp (streamable HTTP, stateless). Every harness's config holds only that URL and an Authorization: Bearer header, rendered from KANBAN_TOKEN at deploy time into the same mode 0600, deny-listed files that carry MEMORY_ROUTER_TOKEN. Without the token the entry is left out. Codex marks the server required = false, so an unreachable board never blocks startup. Tools, tool schemas and server instructions ship with the board; no tool change needs a machine update.

Native Claude Code, Codex and Cursor hooks and the OpenCode plugin mint a work handle for the current native session and run generation and register it with the board at session start (one 3-second attempt, then the local queue). The repo comes from the working directory's GitHub origin; outside a checkout, or for a repo the board does not list, the session registers without one and its first claim binds it. The start hook injects only the handle line; Codex, Cursor and OpenCode also get the server instructions from GET /api/mcp/instructions, so the workflow reaches them even if they do not surface MCP initialize instructions.

Lifecycle calls are session-scoped, so hooks never know which claim a session holds: activity at most once a minute, release-active when a turn stops, and end at session end. A new turn settles the previous turn's Stop first: a Stop never sent is deleted locally, and one that may have been sent is cancelled on the board, which answers atomically whether it already applied. The only Kanban tool the pre-tool hook looks at is claim_ticket, by name: while an earlier Stop is unsettled and the board is unreachable, the claim is refused with "retry the claim". Compaction and active child or tool work defer the Stop.

The operational registry is ${XDG_STATE_HOME:-$HOME/.local/state}/aicoding/kanban-work.sqlite3 (directory 0700, database 0600). It holds execution identity, the delivery queue and Stop settlement state; ended generations and native-event receipts are kept for seven days, and the queue is capped at 1024 rows with activity evicted first. It coordinates processes of one user and is not a security boundary against that user.

Lifecycle mutations work for every supported client, whatever its version: the clients release several times a day, so a per-version allowlist could never keep up.

Agents complete work through the kanban MCP's complete_ticket, which needs the session's claim. There is no command-line fallback.

Claude Code Plugins (Marketplace)

  • frontend-design
  • playwright
  • code-simplifier
  • claude-code-setup
  • pyright-lsp

Custom Skills (shared by Claude Code and opencode)

Skill Purpose Auth
cloudflare-browser Fetch web content via Cloudflare Browser Rendering REST API (backup for firecrawl) API token

Hooks

  • custom-statusline.js — Powerline-style status bar with context window, rate limits, git branch
  • bw-deny-files.sh — PreToolUse hook that blocks agent access to secrets and private keys (~/.aicodingsetup/.secrets.env, *-ship, *.pem, *.key, id_rsa/id_ed25519, .netrc, .pgpass) across Read/Edit/Write/Grep/Glob and Bash. Originally vendored from bw-AICode; forked 2026-08-21 because upstream only armed it inside the bubblewrap sandbox (BW_DENY_PATTERNS_FILE), making it a no-op everywhere else. The built-in list is now always enforced and that env var only adds patterns. Escape hatch: secrets-check. Also runs on Codex — same script, installed as a managed hook (see Secrets). Covered by tests/bats/secrets-deny-hook.bats and tests/bats/codex-managed-hooks.bats.
  • redact-sessions-hook.sh / redact-sessions-pending.sh — Stop, SessionEnd and SessionStart hooks around redact-sessions (see Secrets). The first sweeps transcripts on disk after every turn and scrubs the session's own file at exit; the second announces, at every session start, any key whose live value was found in a transcript and has not been acknowledged with redact-sessions --ack KEY. Both fail-open. The same two scripts are wired into cursor via ~/.cursor/hooks.json and into codex as managed hooks in /etc/codex/requirements.toml (SessionStart, Stop, SessionEnd); codex's notify also goes through codex-turn-done, which sweeps after flagging the window.
  • check-archived-docs.sh — SessionStart hook. Emits a one-line banner when a project using the reference docs layout has docs with status: done in any docs/*/active/ folder. Fail-open.

Shared workflows

See Claude/Codex parity for plugin installation, reciprocal harness review, validation, and the remaining differences. Accepted tool limitations are recorded in Known upstream issues.

  • housekeep — Shared skill (/housekeep in Claude, $housekeep in Codex). Sweeps docs/*/active/ for docs with status: done frontmatter and moves them into the sibling archive/. Also prunes [x] items older than 14 days from TODO.md.
  • wrapup - Shared skill (/wrapup in Claude, $wrapup in Codex). End-of-session check: compares the work with the request, reconciles kanban tickets, gathers git facts with check.sh, fixes what is safe, and answers whether closing loses anything: SAFE TO CLOSE, with any unfinished work listed as carrying over, or DO NOT CLOSE: <N> blockers.

Project templates

templates/project/ in this repo is the reference layout for a new project (CLAUDE.md, AGENTS.md, TODO.md, docs/{specs,plans,notes}/{active,archive}/, docs/SHIP_CHECK.md, project .claude/settings.json with the North Star and ship-check hooks, .dev-process/routes.json, .github/pull_request_template.md, .gitignore). It is not deployed anywhere: agents copy it from a blueprint checkout or the active immutable release and substitute the {{PROJECT_NAME}}/{{PURPOSE}} placeholders, per the global CLAUDE.md. The former /scaffold-project command and its ~/.aicodingsetup/templates/ mirror were retired (the secrets deny hook blankets ~/.aicodingsetup, so the command could never read its own templates); remove_legacy_project_templates() cleans the old mirror up.

Container-side helpers

  • ~/.bashrc.d/aicoding-env.sh — empty by default; put container-wide export FOO=bar lines here. Sourced from every login shell via the managed block in ~/.bashrc.
  • ~/.bashrc.d/aicoding-ssh-auth-sock.sh — stabilizes the forwarded SSH agent socket across DevPod / Cursor reconnects. Routes every shell through ~/.ssh/agent.sock (a symlink we keep current). Without it, long-lived tmux panes hold a stale SSH_AUTH_SOCK path after the host's SSH session rotates, and git push fails with Permission denied (publickey) until you open a new pane.
  • ~/.codex/config.toml: smart TOML-managed file; declares the 6 MCPs in [mcp_servers.<name>] tables with secrets substituted privately at deploy time. Existing model, reasoning effort, and project trust remain user-owned. Other blueprint settings use setting-level three-way comparison. The Kanban entry is command-only.
  • ~/.cursor/mcp.json — mixed managed file (blueprint MCP entries owned, yours kept); declares the 5 MCPs in JSON {mcpServers: ...} (Claude-Desktop-compatible schema). User-added entries are preserved by the merge.
  • ~/.cursor/skills/aicoding-estate/SKILL.md — blueprint-owned managed file; Cursor's only file-backed global instruction surface (User Rules live in the account, ~/.cursor/rules is not read by the CLI). Carries the memory-retrieval, canonical Kanban MCP pointer, backlog-board recovery guidance, and secrets guidance that Claude gets from ~/.claude/CLAUDE.md and Codex from ~/.codex/AGENTS.md.

External Tools (detected, not installed)

Secrets

Secrets are stored at ~/.aicodingsetup/.secrets.env (outside the repo).

Agents must never read that file. Reading it copies live credentials into a transcript that is persisted and distilled to the wiki. Four layers enforce this:

Layer Agent Kind
bw-deny-files.sh PreToolUse hook Claude Code hard — blocks Bash too
permissions.deny in settings.json Claude Code hard — file tools
permissions.deny in cli-config.json Cursor hard — file tools
permission.read / permission.bash maps OpenCode hard — file tools + shell patterns
bw-deny-files.sh as a codex managed hook Codex hard — blocks Bash and apply_patch
AGENTS.md / CLAUDE.md prohibition all four soft — backstop

Those layers are a denylist of locations, and a value moves: docker compose config interpolates it, a build-failure notification carries it base64-encoded, a helper script writes it into a scratch env dir. Three such leaks in two days (2026-08-27, 2026-09-04) motivated the output side, redact-sessions: it sweeps the persisted transcripts of every CLI (Claude Code and its subagents, codex, cursor's agent-transcripts and chat JSON files) for the secrets-file values, in raw, JSON-escaped and base64-aligned form, replaces each with [REDACTED:KEYNAME], and records the hit under ~/.claude/state/redact-sessions/ (a shared mount, so every container sees it). A hit still means the value reached an agent, so the next session start on any container repeats the warning until the key is rotated and redact-sessions --ack KEY is run. Triggers: Claude Code Stop and SessionEnd, codex Stop and SessionEnd as managed hooks (plus notify), cursor stop/sessionEnd, and container boot. Only one sweep runs at a time across all containers (sweep.lock); a trigger that finds it busy asks the running sweep for one more pass. Transcripts only grow, so each file is read in full once and afterwards only from the byte offset last found clean (offsets.<host>); a clean file is never rewritten. Before 2026-09-30 every trigger started its own full read and rewrite of every touched file, and a rule change made that a rescan of all 4.5 GB that never finished within its five-minute limit, which saturated the shared host's disk. Live files are handled with a quiet period plus a check-and-swap write, not an open-file test: the transcript roots are shared across containers with separate PID namespaces, so no process list is trustworthy. Claude Code appends by path and never holds the file open, so its files are replaced by rename; codex keeps its rollout open with O_APPEND for the whole run, so its files are rewritten in place (both measured 2026-09-07). Cursor's store.db files and OpenCode's opencode.db go through lib/redact-sqlite.py: one transaction under secure_delete, then a WAL checkpoint. Cursor's store is content-addressed (every blob id is the sha256 of its data), so the helper rehashes changed blobs and patches every ancestor up to the root pointer. Specs: docs/superpowers/specs/2026-09-07-redact-sessions-design.md and docs/superpowers/specs/2026-09-07-redact-sessions-sqlite-design.md.

Codex implements the same PreToolUse contract as Claude Code — same tool_name/tool_input.command input, same hookSpecificOutput.permissionDecision: "deny" response — so it runs the very same script (verified against codex-cli 0.148.0). The catch: codex gates every non-managed hook behind a trust hash and silently skips it until a human runs /hooks in the TUI. ~/.codex/hooks.json would therefore be inert on a fresh machine — the exact bug this change exists to fix — so ensure_codex_managed_hooks() installs it to /etc/codex/requirements.toml instead, where hooks are trusted by policy and cannot be disabled from the user hook browser.

That one step is the only part of the install that needs root, and it escalates for itself — never run sudo aicoding-install. Behaviour by context:

Context What happens
root, or passwordless sudo (containers) writes silently
sudo needs a password, terminal attached explains why, then prompts for that step alone
non-interactive (CI, --yes in a pipe) warns once and continues
--boot sync silent skip — it runs on every container start and must not nag

aicoding-sync reconciles it too, not just aicoding-install, so an existing container self-heals on its next boot instead of waiting for someone to re-run the installer.

To answer "is this key set?" without reading anything, run secrets-check: it prints key names, set/empty, length and a per-machine salted fingerprint — never a value — and exits non-zero if a requested key is empty.

$ secrets-check GH_TOKEN
KEY                          STATUS       LEN  FINGERPRINT
GH_TOKEN                     set           93  d8ee9caf

The token is not only in the file

Denying the secrets file alone still left three routes to the same GitHub token. All closed 2026-08-21:

  • The environment. GH_TOKEN used to be exported into every shell, so printenv GH_TOKEN handed it straight over. No longer exported — see unset GH_TOKEN GITHUB_TOKEN in configs/bash/env.sh.
  • The credential helper. git-credential-aicoding get and git credential fill print the token by design. Agent-typed invocations are denied; git's own internal calls are not tool calls and still work.
  • gh auth token, likewise denied.

Nothing lost GitHub access, because neither client actually needed the variable: git authenticates through git-credential-aicoding, which reads the secrets file directly, and gh now has its own stored login, refreshed from that same file on every boot sync by ensure_gh_stored_auth(). Its ~/.config/gh/hosts.yml is deny-listed too.

The ceiling is unchanged and worth stating plainly: a devpod is not a security boundary, and anything that can run git can still make it produce a credential. This stops a cooperative agent from copying a live token into a transcript — the failure that actually happens — not a determined attacker.

Key Used By
FIRECRAWL_API_KEY firecrawl MCP
BRAVE_API_KEY brave-search MCP
CLOUDFLARE_API_TOKEN cloudflare-render broker (read in-process, never rendered into the skill)
CLOUDFLARE_ACCOUNT_ID cloudflare-render broker (read in-process, never rendered into the skill)
  • Install: prompts for all keys (Enter to skip)

  • Update: only prompts for new keys, never overwrites existing values

  • MCP keys are injected into MCP config blocks

  • Agent-readable markdown (skills, slash commands, subagents, CLAUDE.md, AGENTS.md) gets {{HOME}} expanded and nothing else — no key is ever substituted into a file an agent reads as prose. A skill that needs a credential calls a broker (cloudflare-render, dokploy-api, kuma-admin, measure-remote, redact-transcript, redact-sessions, git-credential-aicoding), which reads the value in-process and never prints it.

    dokploy-api (panel API, DOKPLOY_API_TOKEN) and kuma-admin (Uptime Kuma's socket.io admin session, KUMA_ADMIN_USER/KUMA_ADMIN_PASSWORD; Kuma has no REST API and its "API keys" only unlock /metrics) also redact secret-shaped fields in what the servers return: env blocks come back as variable names only, credential fields as <redacted>. A value that is itself a secret moves between them by pipe, never by print: kuma-admin push-url NAME | dokploy-api set-env compose ID VAR (or set-env application ID VAR for a Dokploy application).

In devcontainers the file is bind-mounted read-only (a single-file mount stacked over the rw ~/.aicodingsetup mount) so no in-container tooling or agent can rewrite or delete the host-side source of truth. Two consequences:

  • The file must exist on the host before provisioning (touch ~/devpod/aicodingsetup/.secrets.env on a fresh host) — Docker creates a directory in place of a missing single-file bind source.
  • A single-file bind pins the file's inode: after editing on the host with a rename-on-save editor (vim, sed -i), running containers keep seeing the old content until restarted. Edit in place (nano, echo >>) or restart the container after rotating tokens.

Update

Two distinct flows after the initial install:

Which one do I run?

Normally neither. aicoding-auto-update checks every six hours and catches up after restart. Run aicoding-status for scheduler health, update activity, local attempt/completion/next-run times, installed tool versions, and dated update results. When something is blocked, aicoding-status --doctor explains each recorded blocker and names the command that fixes it. To request a pass now, run aicoding-auto-update --once.

Agent CLIs (Claude, Codex, OpenCode, Cursor) update through that same path, not their own updaters. ~/.local/bin/claude is an aicoding wrapper around ~/.local/share/aicoding/current/claude. It switches Claude's built-in background updater off (DISABLE_AUTOUPDATER=1, keeping plugin auto-update with FORCE_AUTOUPDATE_PLUGINS=1), and claude update or claude upgrade runs aicoding-auto-update --once instead, on containers and host-profile machines alike. claude doctor reports the switch. Once the managed release is live, the updater removes the unused ~/.local/share/claude/versions/ tree that the built-in updater used to fill.

The tmux badges provide a compact reminder:

Badge What moved on blueprint main What happens next
⬆sync anything sync can deliver: managed configs, MCP/plugin definitions, agent-CLI updates, sync's own code managed installs wait for the background updater to qualify CI and apply it; legacy installs can run aicoding-sync
⬆install provisioning itself: install.sh, lib/provision*, image/ managed installs report automatic provisioning pending; legacy installs can run aicoding-install
⬆provision! automatic provisioning for the active release is blocked or failed run aicoding-status --doctor for the recorded blockers and their fixes
⬆rebuild the base image rebuild the container from your laptop

Rule of thumb: supported agent harnesses, plugins, MCPs, and agent CLIs are sync territory. The updater selects exact versions, stages and validates them away from the active installation, then atomically changes a stable launcher. Cursor Agent uses the exact official Linux archive and validates it before activation. System tools and image capabilities have a narrower policy. A supported component update may install a required host prerequisite noninteractively. Inside a container, a missing image capability is recorded as a deferral and waits for a manual image rebuild. General OS, package, and image maintenance remains explicit install or rebuild work.

Normal commands select the newest commit on main whose exact required CI run succeeded, stage it under ~/.local/share/aicoding/versions/aicoding/<sha>, and atomically switch durable launchers to that immutable release. An offline pass keeps the active release. --blueprint mode remains the explicit local development path and never fetches or resets its checkout.

aicoding-sync — day-2 reconciliation (recommended)

aicoding-sync --dry-run    # list the files that would change; writes nothing
aicoding-sync              # apply managed config, refresh tools and provisioning
aicoding-sync --blueprint /path/to/aiCodingBaseSetup --dry-run  # test a local checkout verbatim

aicoding-sync is installed into ~/.local/bin/ by install.sh. Every mode, including the unattended --boot pass, applies managed config the same way and never prompts (--yes is accepted for old callers). The rules are listed under Managed config below. For Codex, model, model_reasoning_effort, [projects.*] and [tui] stay personal (a model still equal to an earlier blueprint default follows the new one); the blueprint enforces notify, the approval and sandbox posture, its [mcp_servers.*] entries and its [features] keys.

Subscription context defaults use the existing ChatGPT login. OpenCode's openai/gpt-6.2-sol entry declares 1,050,000 total context, 922,000 input, and 128,000 output tokens, with automatic compaction and a 20,000-token reserve. These are model metadata and client budgets, not an authentication change or a guarantee of one million input tokens. Codex requests an 872,000-token context window and compaction at 780,000. Its active model catalog can cap the resolved window. These two Codex settings are seeded: sync writes them only when they are missing, so personal budgets stay. Restart each client after its config updates. Repo-local overrides still take precedence over these home-level defaults.

The Codex TOML merge needs Python 3.8 or newer and the vendored tomlkit. On a machine without it, sync records the Codex config as failed and leaves the file untouched. Run aicoding-install; containers can bootstrap the package, while hosts retain the manual-install policy described below.

(The former aicoding-update and update-status names were back-compat shims and have been removed; use aicoding-sync and aicoding-status.)

Sync keeps three one-line files in ~/.local/state/aicoding/: profile (host, container or minimal-pi), blueprint_commit and provision_commit. They are container-local, not under ~/.aicodingsetup, which is a host bind mount shared by every devpod container. The update-status cache (~/.local/state/aicoding/updates/) is container-local for the same reason and stores only the remote latest SHA. On managed installations, aicoding-status reads the installed SHA from the physical immutable release selected by current/aicoding; the blueprint_commit stamp is the fallback for older installs. Provision badges use the active release plus local result receipts, so they do not depend on a /tmp/aicoding Git clone surviving.

Older releases kept a per-container manifest.json (and a shared copy under ~/.aicodingsetup). The first sync or install on this release copies its profile and commit stamps into the files above, and deletes both manifests and ~/.codex/.aicoding-sync/ after a clean pass.

aicoding-install — select a qualified release and re-run the installer

aicoding-install                     # select latest CI-qualified main and re-run the saved profile
aicoding-install --blueprint /path/to/aiCodingBaseSetup  # provision from a local checkout

Re-running the installer re-runs the apt/build/locale prerequisite steps (idempotent), including ensuring Python 3.8 or newer for the Codex TOML merge, then applies managed config exactly as sync does. Use it when provisioning-only pieces broke or changed (tool bootstrap including codex, templates, tmux plugins, Playwright browser and system libs); aicoding-sync deliberately does not touch those. Running ./install.sh from a checkout does the same against that checkout's version.

aicoding-install is profile-aware: it preserves container, host, or minimal-pi from persistent state before dispatching the selected release. The stable commands in ~/.local/bin resolve the current release once and then execute its physical script, so an update cannot change resources below an already running process.

Bare-host install (no devcontainer)

For a laptop or server that isn't a devpod container, the host profile deploys the thin core layer and enrolls the same persistent updater: Claude, managed shared agent configuration including Codex TOML, the homelab wiki, terminal-open auto-sync, the sandbox prerequisite, and bw-AICode tooling. It skips container-only CLI bootstrap, Playwright, Go, and tmux. Because Codex TOML merging needs it, Python 3.8 or newer is a host prerequisite; host checks report the manual install command rather than installing it. The minimal-pi profile installs only the common aicoding runtime and the selected dvw bastion adapter; it does not install Claude, project configuration, or container tooling.

gh auth login          # or put GH_TOKEN in the secrets file and run
                       # aicoding-sync, which logs gh in from it
git clone https://github.com/vossiman/aiCodingBaseSetup && cd aiCodingBaseSetup
./bootstrap-aicoding.sh --profile host       # or: --profile minimal-pi

Persistent automatic refresh

aicoding-auto-update --ensure enrolls a six-hour persistent systemd user timer when a real user manager and linger are available. Otherwise one locked, detached worker retries with bounded backoff. Repeated ensures are idempotent, and shell startup only dispatches enrollment without foreground network work. Container startup also retains uv maintenance and the detached transcript sweep through the active runtime startup hook. State and bounded logs live in ~/.local/state/aicoding/auto-update/.

Plain aicoding-status reads local state and checks scheduler/process liveness; it does not install updates or start/restart the scheduler. A saved PID or an overdue scheduled timestamp alone is not evidence that the worker is alive. Tool results are cached observations with their own timestamps, not new checks for the latest available version. Missing results mean unknown, and older failures remain unresolved until a relevant update verifies recovery. A config result is current only when every destination sharing it was written or already matched. --banner and --tmux retain their lightweight notice paths.

Each scheduled pass runs aicoding-sync --boot with closed stdin from that state directory. Different CLIs have different update paths:

CLI Update path Scheduled?
Claude Code exact requested version through the official installer in isolated staging, then validated immutable activation ✅
opencode newest v2 GitHub release (anomalyco/opencode, plain v2.x.y, no drafts or prereleases), archive checked against the release SHA256SUMS, safely extracted and version-probed before immutable activation. The managed launcher always sets OPENCODE_DISABLE_AUTOUPDATE=1, sends a bare opencode update/upgrade to aicoding-auto-update --once, passes --help through and refuses a version or other flags; the blueprint also owns "autoupdate": false as a fallback for launches that bypass it. The devbox image seeds v2 from the same checksum-verified archive ✅
Cursor Agent exact Linux x64/arm64 archive selected from the official installer, safely extracted and version-probed before immutable activation ✅
OpenAI Codex exact npm version plus matching codex-code-mode-host, validated before immutable activation ✅

Firecrawl, Brave, Context7 and Playwright MCP servers use the same exact npm staging model, retaining each complete dependency tree. Playwright also binds its browser cache to the package version. Every stable wrapper resolves its current/<component> link once and executes a physical version directory, so an already-running process keeps its original code and resources. Releases and the prior previous/<component> pointer are retained for recovery. See Automatic updates and shared compatibility for the on-disk layout, receipts, and shared-consumer rollout gate.

Managed config

Every install and sync applies four rules. There is no record of past deployments, so there is nothing to drift out of step and no conflict to resolve.

  1. Blueprint-owned files are overwritten. Hooks, commands, skills, agents, CLAUDE.md, AGENTS.md and the ~/.bashrc.d/aicoding-*.sh snippets are rendered ({{HOME}} everywhere, secrets only in configs, never in prose) and written whenever the destination differs. Writes use a private temp file and an atomic rename; executables land at 0700, the rest at 0600. Change these files in the repo, by PR.
  2. Mixed files: owned keys are enforced, seeded keys are set once. ~/.claude/settings.json, ~/.cursor/mcp.json, ~/.cursor/cli-config.json, ~/.config/opencode/opencode.json and ~/.codex/config.toml list their keys in configs/managed-config.json. Owned keys take the blueprint value on every pass; .* owns each blueprint entry under a key and [] adds missing array items, so personal entries stay. Seeded keys are written only when missing. A seeded key listed in reseeded_keys also moves to the current seed while it still holds a value the blueprint shipped before (for example the Codex and OpenCode default model). Sync compares values only, so an old default you set on purpose moves too; any value outside the shipped list stays. An entry with requires waits until that tool reports at least min_version, so a new default never replaces a working one the installed tool cannot run. Everything else is personal. A blueprint MCP entry whose secret is missing is removed. A file that is not valid JSON or TOML is reported and never overwritten. ~/.bashrc gets one marker block that sources ~/.bashrc.d/*.sh; the rest of the file is yours.
  3. Retired files and keys are listed in the same data file. A retired file is deleted only while it still equals a version the blueprint shipped (checked against git history); an edited one is kept and reported once.
  4. The machine profile lives in ~/.local/state/aicoding/profile. Hosts keep Codex at approval_policy = "on-request" and sandbox_mode = "workspace-write"; containers run without prompts.

A destination whose tool is not installed or not yet verified is left alone and recorded as blocked until the tool is ready.

Containers on one host share ~/.claude, ~/.codex and ~/.cursor. Each pass records its release's position on main (the number of commits behind it) in ~/.claude/.aicoding-release; a container on an older release leaves files under those three directories to the newer one and only updates its own container-local files. A local --blueprint run always writes and never moves that marker. A release without a known position (a fresh bootstrap, a shallow checkout) yields to any existing marker until its first staged update. An older release also skips shared plugin and MCP provisioning.

The ~/.bashrc.d/ convention for user additions: anything matching local-*.sh (or any name not prefixed aicoding-) is sourced by the managed block but never touched by the blueprint. Personal aliases, env vars, and shell tweaks belong there.

The container hostname is set to the workspace name via runArgs: ["--hostname", "${containerWorkspaceFolderBasename}"], so shells and logs show e.g. devmachine instead of a docker id.

Windows

Unsupported. A quarantined PowerShell stub lives at contrib/windows/install.ps1 for archaeology only — use WSL with bash bootstrap-aicoding.sh --profile host. For a local checkout, use AICODING_PROFILE=host aicoding-install --blueprint /path/to/checkout.

Devcontainers (DevPod / Codespaces / VS Code Dev Containers)

When run inside a container, install.sh detects the environment automatically and:

  • Auto-installs prerequisites it needs (git, jq, claude CLI, locales + de_AT.UTF-8/en_US.UTF-8) via apt/npm. No manual prep.
  • Skips interactive prompts for missing API keys (assumes secrets are bind-mounted from the host or absent).

Detection triggers on any of: /.dockerenv, /run/.containerenv, REMOTE_CONTAINERS, DEVCONTAINER, or CODESPACES env vars.

To force the same behaviour on a host (e.g. CI), set:

AICODINGSETUP_AUTO_INSTALL=1 AICODINGSETUP_NONINTERACTIVE=1 ./install.sh

Drop-in .devcontainer/devcontainer.json

Canonical template lives next to this README at devcontainer.json. Copy it into your project's .devcontainer/ directory:

(
set -e
blueprint_sha=$(aicoding-select aicoding)
mkdir -p .devcontainer
curl -fsSL "https://raw.githubusercontent.com/vossiman/aiCodingBaseSetup/$blueprint_sha/devcontainer.json" \
  -o .devcontainer/devcontainer.json
)

postCreateCommand reconstructs the reviewed bootstrap-aicoding.sh embedded in the JSON. That verifier uses the public GitHub API to select an exact CI-qualified main commit, checks its persistent-enrollment capability, and only then runs downloaded code. postStartCommand resolves the physical active runtime and invokes its on-start.sh, preserving uv maintenance and the detached transcript sweep alongside scheduler enrollment. Missing enrollment warns without failing startup; the hook never fetches executable raw main code.

containerEnv overrides three BASH_FUNC_*%% env vars that universal:6 leaks with truncated multi-line bodies — without it bash errors on every spawn (see vscode#3928, vscode-remote-release#9457). install.sh and on-start.sh further re-exec themselves under env -u to belt-and-braces the same problem.

remoteUser must match the image's hardcoded user — codespace for universal:6, vscode for most others (python, base, etc.). Mismatch → mounts land at the wrong path and nothing works.

The template ships with "mounts": [...] wired for a DevPod-style backend (e.g. vossisrv hosting all containers): bind-mounting six dirs gives all four CLIs, plus uv, persistent state across every container the user spins up:

Host source Container target What persists
…/aicodingsetup/ ~/.aicodingsetup/ .secrets.env, manifest.json
…/aicodingsetup/.secrets.env ~/.aicodingsetup/.secrets.env (read-only) overlay on the row above — see "Secrets"
…/claude/ ~/.claude/ Claude credentials, settings, plugins
…/opencode/ ~/.local/share/opencode/ opencode auth.json (per-provider tokens)
…/codex/ ~/.codex/ codex auth.json, config.toml, and private smart-merge receipt state
…/cursor/ ~/.cursor/ cursor-agent credentials + mcp.json
…/uv/ ~/.local/share/uv/ uv-managed Python interpreters and tool venvs, so a persisted project .venv survives an image bump (on-start.sh re-syncs a .venv whose interpreter is gone anyway)

install.sh reconciles ~/.codex/config.toml and ~/.cursor/mcp.json on every rebuild. Codex safe changes apply automatically while personal settings and unresolved conflicts remain local; auth files persist untouched.

These source= paths assume a ~/devpod/... host layout. If your host differs, edit the source= paths to match, or drop any mounts you don't need — the template works without them, you just lose cross-container persistence for those tools.

Why both .credentials.json and ~/.claude.json matter

Claude Code reads OAuth tokens from ~/.claude/.credentials.json and checks ~/.claude.json (a file at home root, not inside .claude/) for hasCompletedOnboarding: true. Without that flag, the CLI treats every session as a fresh install and prompts for login even when valid tokens exist. install.sh writes that flag automatically when it sets up MCPs — without it, copying the credentials file alone is not sufficient to authenticate a container.

Agent logins (one-time interactive)

All four CLIs use the same pattern: log in once in any DevPod workspace, and the credential file lands in the bind-mounted home directory — every future workspace inherits the auth automatically.

CLI Login command Where the token lands
Claude Code claude → browser OAuth flow ~/.claude/.credentials.json
opencode opencode auth login <provider> ~/.local/share/opencode/auth.json
OpenAI Codex codex on first run → ChatGPT sign-in (or OPENAI_API_KEY env var) ~/.codex/auth.json
Cursor Agent agent login (or cursor-agent login) — or CURSOR_API_KEY env var inside ~/.cursor/

HTTP-based MCPs that need their own OAuth (logfire, claude.ai Google Drive, etc.) still require a browser flow per-MCP via claude → /mcp → select the MCP → follow the link. State persists in the bind-mounted ~/.claude/, so every future workspace inherits it.

How It Works

install.sh
  1. Detect environment (Linux / WSL / container)
  2. Auto-install prereqs in container mode (git, jq, claude CLI, locales, tmux)
  3. Load or prompt for secrets (~/.aicodingsetup/.secrets.env — non-interactive in containers)
  4. Report unmanaged components (leave untouched)
  5. Configure Claude Code MCPs (claude mcp add)
  6. Install Claude Code marketplace plugins
  7. Install aicoding-sync symlink → ~/.local/bin/aicoding-sync
  8. Apply managed config (see Managed config)
  9. Stamp the profile, blueprint and provision commits
 10. Install tmux plugins (TPM), clone/update bubblewrap, detect infra-audit,
     check Playwright

File deployment is centralised in lib/blueprint-deploy.sh (managed_config_apply), with the Codex TOML merge in lib/managed_toml.py.

The same persist-once-share-everywhere property applies to all four CLIs once their bind mounts are wired: claude, opencode, codex, and agent each persist their auth into their respective bind-mounted home directories, so a single login in any container is reusable from every other.

Repo Structure

aiCodingBaseSetup/
├── install.sh                     # container installer
├── bootstrap-aicoding.sh          # self-contained verified first enrollment
├── on-start.sh                    # container startup maintenance + scheduler ensure
├── contrib/windows/               # quarantined Windows stub (unsupported)
├── bin/
│   ├── aicoding-auto-update       # one-shot, scheduler enrollment, fallback worker
│   ├── aicoding-install           # select an exact release and re-run its profile
│   ├── aicoding-sync              # day-2 reconcile + boot sync
│   ├── aicoding-status            # readable updater status plus banner/tmux notices
│   └── aicoding-ssh-agent-watch   # legacy ssh-agent socket watcher
├── lib/
│   ├── blueprint-deploy.sh        # render, merge and write managed config
│   ├── blueprint-source.sh        # --blueprint PATH parsing + validation
│   ├── auto-update.sh             # systemd/fallback scheduler implementation
│   ├── runtime.sh                 # immutable staging + transactional activation
│   ├── provision.sh               # MCPs, plugins, npm packages (shared w/ sync)
│   ├── provision-system.sh        # environment, tool bootstrap, prerequisites
│   ├── provision-secrets.sh       # secrets loading and prompting
│   ├── provision-managed-files.sh # first/adopt/reconcile managed-file paths
│   ├── provision-integrations.sh  # CLI links, TPM, bubblewrap, Playwright
│   └── sync.sh                    # auth plumbing + aicoding-sync core
├── .secrets.env.example           # Template for required API keys
├── configs/
│   ├── bash/                      # env, aliases, ssh-auth-sock, update-notify
│   ├── claude/                    # settings, CLAUDE.md, hooks/
│   ├── codex/                     # config.toml (smart TOML-managed defaults + MCPs)
│   ├── cursor/                    # mcp.json + cli-config.json
│   ├── git/                       # git-credential-aicoding
│   ├── opencode/                  # opencode.json
│   └── tmux/                      # tmux.conf
├── skills/                        # Shared skills → ~/.claude/skills
├── templates/project/             # Mirrored to ~/.aicodingsetup/templates/project
├── tests/bats/                    # bats-core suite (run via tests/bats/run.sh)
├── tools/render-debug/            # Optional tmux/statusline debug harness
└── vendor/                        # External clones (gitignored), e.g. bw-AICode

Per-CLI MCP configs live under configs/{codex,cursor,opencode}/ plus Claude registration via lib/provision.sh (MANAGED_MCPS). There is no shared mcps.json generator yet — keep those lists in sync by hand when adding an MCP.

Two delivery channels (dev vs runtime)

Channel What When
Parent submodule (devMachine → devpod/aicoding) Editable checkout pinned to a SHA Developing / reviewing this repo
Immutable runtime (~/.local/share/aicoding/versions/) Exact CI-qualified releases used by installed commands bootstrap, aicoding-install, scheduled aicoding-sync

Edits in the submodule do not affect a running container until they land on main unless you explicitly select it with --blueprint. Local mode resolves and validates the path, reports its branch/commit/dirty state, and performs no fetch or reset—the working tree, including uncommitted edits, is the source of truth for that command:

aicoding-sync --blueprint "$PWD/devpod/aicoding" --dry-run
aicoding-sync --blueprint "$PWD/devpod/aicoding"       # review, then apply

# For installer/provisioning changes rather than day-2 config sync:
aicoding-install --blueprint "$PWD/devpod/aicoding"

The option is per invocation; normal automatic sync continues to select and activate qualified immutable releases. AICODING_BLUEPRINT_CLONE and AICODING_BLUEPRINT_REMOTE remain internal controls, not the safe local-checkout interface. dvw new separately seeds devcontainer.json from tip-of-main by default (DVW_BLUEPRINT_DEVCONTAINER_URL).

A smart receipt created from --blueprint records local provenance. Ordinary sync will not silently switch it back to tracking. To return, update that same checkout to a clean origin/main and explicitly run aicoding-sync --blueprint /path/to/checkout once more. Different origins are refused.

Test Your Setup

After running the installer, paste the test prompt from test-prompt.md into Claude Code or opencode to verify everything works.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages