GitNexus/.devcontainer/agent-assets
Gergő Magyar 26636d7a05
feat(devcontainer): provision the Claude Code and Codex agent setup (#3946)
* feat(devcontainer): provision the Claude Code and Codex agent setup

The dev container seeds ~/.claude and ~/.codex once from the host. A
config copied from a Windows host names MCP servers, a notify program
and plugin marketplaces by C:\ paths that fail on every start in the
Linux container, and Codex's bubblewrap sandbox cannot start where the
container cannot create user namespaces. Fixing that by hand is lost on
a volume reset, a fresh clone or another machine.

post-create.sh now ends with agent-setup.cjs, which is idempotent and
safe to re-run:

- drop Windows-only MCP servers, marketplaces and notify from the
  seeded Codex config, and Windows-only MCP servers from ~/.claude.json
- default Codex to full access with ask-on-request when user
  namespaces are unavailable and the config chooses no sandbox mode
- install codex-guard.cjs as a Codex PreToolUse hook that refuses
  recursive deletes of protected roots, force pushes, pushes to main,
  git clean -x, npm publish and similar
- install the side-panels mod for Claude Code
- refetch the marketplace snapshots the seeded Codex config names, and
  give Codex compound-engineering and claude-mem when they are enabled
  in Claude Code
- track the pr-tri-review skill and write its Codex entry, so the
  review runs from either CLI with the other as the second engine

A failed step is reported and the rest still run; GITNEXUS_AGENT_SETUP=off
skips the step. Hook trust in Codex stays a manual step.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* docs(pr-tri-review): run the Codex legs on gpt-6-astra or gpt-6.1-sol at xhigh

The skill still named gpt-5.5 for every Codex leg. One variable now sets
the model for all three legs: CODEX_MODEL, gpt-6-astra unless set, with
gpt-6.1-sol as the cheaper tier. Both take --effort xhigh on the task
legs; adversarial-review still takes a model and no effort. The digest
names the model actually used.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(devcontainer): address PR review feedback (#3946)

- codex-guard: drop redirections before reading the command word, so
  `2>/dev/null rm -rf /` is refused like the plain command
- agent-setup: a TOML table header or string value followed by a comment
  is still a header or a value; a header with a trailing comment no
  longer crashes the Codex config step
- side-panels bus: entries carry the key of the event they record;
  only a second report of the same event is skipped, so the same words
  sent twice are two entries
- side-panels board: the claude-mem list is closed at session end when
  this session relayed to it, also after the board was switched off
- side-panels review run: runs started in the same second are ordered
  by folder time, not by their random suffix
- side-panels worktrees: a worktree whose status cannot be read is
  shown as unreadable, and one with no upstream as "push state unknown",
  instead of clean; a failed `git worktree list` or `git status` fails
  the read rather than showing an empty result

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(devcontainer): judge a guarded command wherever it stands (#3946)

The guard read only the first word of a simple command, after a fixed
list of prefixes. What may precede a command is open-ended, so each
spelling the list missed was a bypass: `2>& 1 rm -rf /`,
`timeout 10 rm -rf /`, `! rm -rf /`, `(rm -rf /)`.

A watched command is now judged at any position in a simple command.
Grouping and substitution marks end a command, so what stands inside
`( )`, `{ }`, `$( )` and backticks is read too, and `eval` is followed
like `sh -c`. `rm` right after a tool with its own rm subcommand
(`git rm`, `docker rm`) is left alone.

The cost is that an unquoted mention is refused as well
(`echo rm -rf /`); a quoted one is not. shutdown/reboot/halt/poweroff
are no longer watched: they do no harm in a container and are common
words as arguments.

Also note in the mod test that a session.send event names its
recipient as a string.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(devcontainer): close the relative-path gap and state the guard's limit (#3946)

- codex-guard: a leading `./` is stripped before a target is matched,
  and `..`, `../*` and `.*` are protected, so `rm -rf ./*` in the
  workspace is refused like `rm -rf *`
- codex-guard and README: describe the guard as a best-effort check on
  command text, not a boundary. A target or command built from a
  variable or a substitution is not seen; refusing every such form
  would refuse routine cleanup. The two computed-target forms are in
  the test table as allowed, marked as the stated limit
- side-panels review run: show the newest run that has a lane written
  in the last six hours, instead of nothing when the newest is stale
- side-panels agents: an idle agent is not dimmed; it counts as active

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(devcontainer): address the fourth round of review feedback (#3946)

agent-setup:
- an approval_policy the Codex config already sets is kept instead of
  being written a second time (TOML refuses a duplicate key)
- a missing config.toml still gets the sandbox default: the file is
  created when the container cannot sandbox
- a quoted table name with dots (`[mcp_servers."win.tool"]`) is read as
  one entry, so its Windows-only server is removed with its subtables

codex-guard:
- `.` and `..` segments in an rm target are resolved before matching,
  so `/workspace/../*` is `/*`
- a hidden-file glob (`dir/.*`) is refused wherever it stands
- `-f` clustered with other short options (`git push -fu`) is a force
  push
- a shell nested past the depth the guard follows is refused unread
- the malformed-payload test no longer inherits CODEX_GUARD

side-panels:
- a message that was not delivered is not put on the bus or relayed

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* refactor(devcontainer): simplify the agent setup code without changing behaviour (#3946)

- agent-setup: one writeText under the backup-keeping writer replaces
  two inline compare-then-write copies
- codex-guard: hoist nameOf, normalise an rm target once per target
- side-panels: one isLive predicate, one block for the worktree name
  lists, the lane dimming derived from statusOf, named review-run time
  windows, one default for a pane's note, one helper to split git
  output into lines, MARKER no longer exported
- side-panels: a pane's independent reads run together, and
  `git status` runs with --no-optional-locks so reading never takes the
  index lock from a git command the person is running

The committed and the simplified script produce the same config files
on identical scratch homes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(devcontainer): close gaps a fifth review pass found (#3946)

- codex-guard: refuse `git push --mirror`, which overwrites and deletes
  remote refs without a force flag.
- agent-setup: a `]` inside a string no longer ends a multi-line `notify`
  array early, so a Windows notify program is removed whole.
- side-panels: `/panels` closes only the panes this mod opened, whatever
  `$.ui.panes()` lists.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-15 18:41:25 +00:00
..
side-panels feat(devcontainer): provision the Claude Code and Codex agent setup (#3946) 2026-11-15 18:41:25 +00:00
codex-pr-tri-review.SKILL.md feat(devcontainer): provision the Claude Code and Codex agent setup (#3946) 2026-11-15 18:41:25 +00:00