Personal user-root light agent system for Claude Code and Codex.
The repo keeps global behavior in version control, but deliberately separates:
- shared working agreements
- Claude-specific prompt, agents, and hooks
- Codex-specific prompt, subagents, rules, and hooks
The goal is to keep the user-root layer thin and stable, while leaving personal machine config such as credentials, MCP servers, model choices, and trusted project state under direct user control.
This repo follows a light split:
shared/: cross-product principles that are stable across toolsclaude/: assets that only make sense for Claude Codecodex/: assets that only make sense for Codex
That split matters because the products do not expose the same primitives:
- Claude uses
CLAUDE.md,~/.claude/settings.json, and Markdown subagents - Codex uses
AGENTS.md,rules/*.rules,hooks.json, and TOML subagents
Trying to force both products through one identical file model creates unnecessary coupling.
For the longer design boundary, including what this repo should borrow from larger toolkits such as ECC and what it should avoid, see docs/design-principles.md.
CLAUDE.md # thin Claude root prompt, imports shared fragments
AGENTS.md # thin Codex root prompt
shared/
communication.md
engineering.md
context-management.md
claude/
agents/
security-reviewer.md
silent-failure-hunter.md
hooks/
log-notification.sh
log-stop.sh
statusline.sh
codex/
agents/
docs-researcher.toml
safety-reviewer.toml
rules/
default.rules
hooks/
log-session-start.sh
log-stop.sh
hooks.json
rules/
clean-architecture.md
go.md
typescript.md
python.md
shell.md
markdown.md
deployment.md
chinese-writing.md
skills/
leveraging-tasks/
providing-knowledge/
investigating/
inspecting/
reflecting-to-root/
scripts/
install.sh
uninstall.sh
bootstrap.sh
config/
claude-hooks.json
codex-config.toml # optional snippet, not auto-merged
Install into your real user root:
bash scripts/install.shBootstrap a new machine by cloning or updating the repo into the standard location and then running the installer:
bash scripts/bootstrap.shRemote one-liner bootstrap:
curl -fsSL https://raw.githubusercontent.com/wayne930242/weihung-user-claude/main/scripts/bootstrap.sh | bashSmoke test against a fake home first:
bash scripts/install.sh --home /tmp/weihung-user-claude-smokeReplace conflicting managed targets only when you mean it:
bash scripts/install.sh --forceForward installer flags through bootstrap the same way:
bash scripts/bootstrap.sh --forceUninstall managed assets and restore from the latest backup when available:
bash scripts/uninstall.shThe installer manages only these user-root surfaces.
~/.claude/CLAUDE.md~/.claude/shared/*.md~/.claude/agents/*.md~/.claude/hooks/*.sh~/.claude/statusline.sh- merge into
~/.claude/settings.jsonusingconfig/claude-hooks.json(hooks +statusLineblock)
~/.codex/AGENTS.md~/.codex/skills/*/~/.codex/agents/*.toml~/.codex/rules/*.rules~/.codex/hooks/*.sh~/.codex/hooks.json
These remain user-controlled on purpose:
~/.claude/settings.local.json~/.codex/config.toml- credentials and auth
- MCP server definitions
- plugin enablement
- personal model preferences
- trust and approval state
This is especially important for Codex. config.toml often carries machine-local trust, MCP, plugin, and feature flags that should not be overwritten by a global prompt repo.
- Default behavior is fail-fast. If a managed target already exists, installation stops.
--forcemoves conflicting files into~/.local/state/weihung-user-claude/backups/<timestamp>/before replacing them.- Claude
settings.jsonis merged, not symlinked, so existing non-hook settings remain intact. - Codex
config.tomlis left untouched in the light layout.
scripts/uninstall.shlooks for the latest backup under~/.local/state/weihung-user-claude/backups/.- If a backup exists for a managed path, that file is restored.
- If no backup exists for a managed path, the managed symlink is removed.
- Managed Claude hooks are removed from
~/.claude/settings.json. ~/.codex/config.tomlis still left untouched, because it is not installer-managed.
Claude supports user memory and imports, so the Claude side is intentionally thin:
CLAUDE.mdholds routing and Claude-only behavior@shared/...imports pull in stable cross-product guidance- hooks are wired through
settings.json, because that is Claude's official hook surface
Current Claude hooks are deliberately minimal:
Notificationlogs to~/.claude/state/weihung-user-claude/hooks.jsonlStoplogs to the same file
The statusline (claude/statusline.sh) is also managed.
Color and a ⚠ icon scale to the model's compact-recommendation threshold.
1M-context models warn at 30% (≈300K tokens); 200K models warn at 70% (≈140K tokens).
Detection keys off display_name containing 1M/1m.
Codex now has first-class support for:
- global and project
AGENTS.md rules/*.ruleshooks.json- custom subagents in
agents/*.toml
This repo uses that split directly:
AGENTS.mdstays focused on general working agreementscodex/rules/default.ruleshandles approval policycodex/hooks.jsonandcodex/hooks/*.shhandle automationcodex/agents/*.tomlhandle specialized delegation
Codex hooks are still better treated as optional infrastructure, not mandatory base config. The installer places the files, but does not auto-enable the experimental hook feature in ~/.codex/config.toml.
If you want to opt in manually, copy the relevant snippet from:
config/codex-config.toml
- The global prompt files are short.
- Approval policy is not mixed into prompt prose.
- Automation is not mixed into prompt prose.
- Product-specific capabilities live in product-specific directories.
- The installer does not silently take over the full home config surface.
The repo currently verifies:
- installer behavior with
tests/install.sh - Claude hook scripts with
tests/hooks.sh - Codex hook scripts with
tests/codex_hooks.sh - bootstrap clone/update behavior with
tests/bootstrap.sh - uninstall restore/remove behavior with
tests/uninstall.sh
- personal values in
settings.json/settings.local.json - generated state such as
todos/,projects/,statsig/ - machine-specific additions outside the managed surfaces above
