oh-my-customcodex 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/index.js +168 -13
  3. package/dist/index.js +150 -8
  4. package/package.json +1 -1
  5. package/templates/.claude/agents/qa-engineer.md +7 -0
  6. package/templates/.claude/hooks/hooks.json +28 -0
  7. package/templates/.claude/hooks/scripts/agent-capability-precheck.sh +99 -0
  8. package/templates/.claude/hooks/scripts/agent-mode-guard.sh +14 -3
  9. package/templates/.claude/hooks/scripts/git-delegation-guard.sh +14 -5
  10. package/templates/.claude/hooks/scripts/plugin-cache-check.sh +42 -0
  11. package/templates/.claude/hooks/scripts/session-reflection.sh +106 -0
  12. package/templates/.claude/output-styles/korean-engineer.md +4 -0
  13. package/templates/.claude/rules/MUST-agent-identification.md +50 -22
  14. package/templates/.claude/rules/MUST-agent-teams.md +6 -2
  15. package/templates/.claude/rules/MUST-completion-verification.md +41 -0
  16. package/templates/.claude/rules/MUST-continuous-improvement.md +15 -1
  17. package/templates/.claude/rules/MUST-intent-transparency.md +29 -0
  18. package/templates/.claude/rules/MUST-language-policy.md +7 -0
  19. package/templates/.claude/rules/MUST-orchestrator-coordination.md +62 -0
  20. package/templates/.claude/rules/MUST-sync-verification.md +15 -1
  21. package/templates/.claude/rules/MUST-tool-identification.md +19 -0
  22. package/templates/.claude/rules/SHOULD-memory-integration.md +7 -2
  23. package/templates/.claude/skills/systematic-debugging/SKILL.md +44 -0
  24. package/templates/.claude/skills/systematic-debugging/phases/amplification-detection.md +25 -0
  25. package/templates/.claude/skills/systematic-debugging/phases/fault-injection.md +31 -0
  26. package/templates/.claude/skills/systematic-debugging/phases/retry-cache-timeout-audit.md +27 -0
  27. package/templates/.claude/skills/systematic-debugging/phases/timeline-correlation.md +26 -0
  28. package/templates/.claude/statusline.sh +40 -9
  29. package/templates/AGENTS.md.en +1 -1
  30. package/templates/AGENTS.md.ko +1 -1
  31. package/templates/CLAUDE.md +1 -1
  32. package/templates/CLAUDE.md.en +1 -1
  33. package/templates/CLAUDE.md.ko +1 -1
  34. package/templates/README.md +4 -4
  35. package/templates/guides/agent-teams/troubleshooting.md +53 -0
  36. package/templates/guides/autonomous-challenge-lessons/README.md +43 -0
  37. package/templates/guides/claude-code/15-version-compatibility.md +107 -0
  38. package/templates/guides/claude-code-tracking.md +51 -0
  39. package/templates/guides/index.yaml +12 -0
  40. package/templates/manifest.json +3 -3
  41. package/templates/tests/tsconfig.json +7 -0
@@ -10,6 +10,40 @@ The main conversation is the **sole orchestrator**. It uses routing skills to de
10
10
 
11
11
  **The orchestrator MUST NEVER directly write, edit, or create files. ALL file modifications MUST be delegated to appropriate subagents.**
12
12
 
13
+ ## Codex-Native Meta-File Boundary
14
+
15
+ Treat orchestration meta-files as delegated surfaces, not direct-orchestrator edit targets. This includes:
16
+
17
+ - `AGENTS.md`
18
+ - `.codex/rules/*.md`
19
+ - `.codex/skills/*/SKILL.md`
20
+ - `templates/AGENTS.md.*`
21
+ - `templates/.claude/rules/*.md`
22
+
23
+ If the change touches routing policy, guide indexes, mirrored templates, or release-time instructions, delegate the edit to the specialist that owns the surface. `mgr-creator` handles new structure and path scaffolding; `arch-documenter` or `mgr-updater` can handle content sync.
24
+
25
+ ### Self-Check Before Editing Meta Files
26
+
27
+ ```
28
+ ╔══════════════════════════════════════════════════════════════════╗
29
+ ║ BEFORE CHANGING A META FILE, ASK YOURSELF: ║
30
+ ║ ║
31
+ ║ 1. Is the target AGENTS.md or under .codex/ / templates/? ║
32
+ ║ YES → delegate; do not edit directly ║
33
+ ║ ║
34
+ ║ 2. Is this a one-line policy, index, or routing tweak? ║
35
+ ║ YES → still delegate; there are no small exceptions ║
36
+ ║ ║
37
+ ║ 3. Does the change need mirrored Codex + template updates? ║
38
+ ║ YES → delegate the pair together, then verify parity ║
39
+ ║ ║
40
+ ║ 4. Am I calling it "temporary" or "debugging" to justify it? ║
41
+ ║ YES → stop; meta-file edits are never direct from orchestrator ║
42
+ ║ ║
43
+ ║ If any answer points to a problem → route the edit first ║
44
+ ╚══════════════════════════════════════════════════════════════════╝
45
+ ```
46
+
13
47
  <!-- DETAIL: Self-Check (Before File Modification)
14
48
  ```
15
49
  ╔══════════════════════════════════════════════════════════════════╗
@@ -147,6 +181,20 @@ Key violations to avoid (file writes, git commands, bundled operations — all m
147
181
  ```
148
182
  -->
149
183
 
184
+ ### Meta-File Examples
185
+
186
+ ```
187
+ ❌ WRONG: Main conversation edits AGENTS.md directly
188
+ Main conversation → Write("AGENTS.md", content)
189
+
190
+ ✓ CORRECT: Main conversation → Agent(mgr-creator) → update AGENTS.md and mirrored template files
191
+
192
+ ❌ WRONG: Main conversation patches .codex/rules/MUST-intent-transparency.md directly
193
+ Main conversation → Edit(".codex/rules/MUST-intent-transparency.md", content)
194
+
195
+ ✓ CORRECT: Main conversation → Agent(arch-documenter) → revise the rule text, then verify the mirrored template file
196
+ ```
197
+
150
198
  ## Historical Sensitive-Path Bypass
151
199
 
152
200
  **Status**: deprecated as of Claude Code v2.1.121 for `.claude/skills/`, `.claude/agents/`, and `.claude/commands/`; fully deprecated in `bypassPermissions` as of v2.1.126 for broader protected paths.
@@ -166,6 +214,20 @@ Claude Code v2.1.141+ preserves the current permission mode when a session is de
166
214
 
167
215
  For this Codex port, native Codex/OMX subagents still follow the active Codex runtime tool policy. Claude compatibility prompts should keep delegated write authority explicit when a workflow relies on unattended edits, but v2.1.141+ no longer needs an extra `/bg` permission-mode workaround.
168
216
 
217
+ ## Agent Capability Pre-Check
218
+
219
+ Before delegating work, compare the task requirements with the target agent frontmatter:
220
+
221
+ | Requirement in prompt | Required frontmatter |
222
+ |-----------------------|----------------------|
223
+ | Shell, CLI, GitHub CLI, package manager, test, build, or script execution | `tools` includes `Bash` |
224
+ | Any `gh`, `git`, `npm`, `bun`, `pnpm`, `yarn`, `python`, `node`, `curl`, `jq`, `make`, or `docker` command | `tools` includes `Bash`; `disallowedTools` does not include `Bash` |
225
+ | Documentation-only synthesis from provided evidence | Bash is not required |
226
+
227
+ Known limitation: `arch-documenter` has `disallowedTools: [Bash]`. Do not ask it to inspect GitHub issues, run shell commands, or collect command output. Pre-collect that evidence with a Bash-capable lane, then delegate the writing task.
228
+
229
+ The `agent-capability-precheck.sh` hook blocks obvious mismatches so the orchestrator re-routes before spawning an agent that cannot execute the requested work.
230
+
169
231
  <!-- DETAIL: Autonomous Execution Mode
170
232
 
171
233
  ## Autonomous Execution Mode
@@ -35,10 +35,24 @@ Also run: mgr-claude-code-bible:verify (official spec compliance)
35
35
  | Missing pages | Source entities without wiki pages → run `/omcustomcodex:wiki` |
36
36
  | Stale pages | Source modification date newer than wiki `updated` field → run `/omcustomcodex:wiki ingest <path>` |
37
37
  | Broken cross-refs | Wiki links pointing to non-existent pages → run `/omcustomcodex:wiki lint` |
38
- | index.md accuracy | Wiki index page count matches actual page count |
38
+ | wiki/index.yaml accuracy | Wiki index page count and indexed file entries match actual page files |
39
39
 
40
40
  Wiki verification is also enforced by CI (`.github/workflows/wiki-sync.yml`).
41
41
 
42
+ ### Structural Migration Verification
43
+
44
+ Directory restructuring, template flattening, branch-strategy changes, generated-file relocation, and package-surface moves require a clean-checkout migration audit before they are considered complete.
45
+
46
+ Required checks:
47
+
48
+ 1. Run the relevant verification from a clean checkout or isolated worktree, not only from a developer tree with untracked files.
49
+ 2. Confirm old paths are no longer referenced by CI, docs validators, template validators, install/init output, and release workflows.
50
+ 3. Confirm new paths are tracked by git and present in packaged templates or generated output where users will rely on them.
51
+ 4. Verify allowlists, `.gitignore`, and template sync checks do not hide missing files.
52
+ 5. Add or update regression tests that fail on the old path assumption.
53
+
54
+ This section is specifically intended to catch migrations where local untracked files or stale CI path references make a release appear healthy while a clean checkout fails.
55
+
42
56
  ### Phase 4: Fix all discovered issues
43
57
 
44
58
  ### Phase 5: Commit via mgr-gitnerd
@@ -13,6 +13,25 @@ Every tool call MUST be prefixed with agent and model identification:
13
13
 
14
14
  For parallel calls: list ALL identifications BEFORE the tool calls.
15
15
 
16
+ ## Short Response Discipline
17
+
18
+ Brief diagnostics and quick checks are not exempt. If a visible response will be followed by a tool call, include the tool prefix first even when the natural-language update is one sentence.
19
+
20
+ Anti-pattern:
21
+
22
+ ```text
23
+ 확인하겠습니다.
24
+ <tool call>
25
+ ```
26
+
27
+ Correct:
28
+
29
+ ```text
30
+ [Codex][gpt-5.5] → Tool: Bash
31
+ [Codex][gpt-5.5] → Target: git status --short
32
+ <tool call>
33
+ ```
34
+
16
35
  ### Common Violations to Avoid
17
36
 
18
37
  ```
@@ -361,7 +361,7 @@ MCP tools (searchable memory backends, episodic-memory) are **orchestrator-scope
361
361
 
362
362
  ### Session-End Self-Check (MANDATORY)
363
363
 
364
- (1) sys-memory-keeper updated MEMORY.md? (2) searchable memory save attempted when a backend is available? Both are required before confirming session-end to the user. See full self-check via Read tool.
364
+ (1) sys-memory-keeper updated MEMORY.md? (2) searchable memory save attempted when a backend is available? (3) If `omcustomcodex-feedback` skill is active, prompt user to trigger it? All three are required before confirming session-end to the user. See full self-check via Read tool.
365
365
 
366
366
  <!-- DETAIL: Session-End Self-Check (MANDATORY)
367
367
  ```
@@ -376,10 +376,15 @@ MCP tools (searchable memory backends, episodic-memory) are **orchestrator-scope
376
376
  ║ YES → Continue (even if it failed) ║
377
377
  ║ NO → ToolSearch + save now ║
378
378
  ║ ║
379
+ ║ 3. Is omcustomcodex-feedback skill available in this project? ║
380
+ ║ YES → Ask user: "이번 세션 피드백을 omcustomcodex-feedback로 ║
381
+ ║ 기록하시겠습니까?" — accept skip ║
382
+ ║ NO → Skip ║
383
+ ║ ║
379
384
  ║ Note: episodic-memory auto-indexes conversations after session ║
380
385
  ║ ends. No manual action needed — do NOT search as "verification" ║
381
386
  ║ ║
382
- BOTH steps must be completed before confirming to user. ║
387
+ ALL applicable steps must be completed before confirming to user.║
383
388
  ║ "Attempted" means called the tool — failure is OK, skipping ║
384
389
  ║ is NOT. ║
385
390
  ╚══════════════════════════════════════════════════════════════════╝
@@ -27,6 +27,7 @@ user-invocable: false
27
27
  4. **한 번에 하나의 가설만 검증한다.**
28
28
  5. **수정 시 "while I'm here" 리팩터링을 금지한다.**
29
29
  6. **수정 시도가 3번 실패하면 추가 패치 전에 구조적 문제를 의심한다.**
30
+ 7. **retry/cache/timeout을 변경하기 전에 false-fix 가능성을 점검한다.**
30
31
 
31
32
  이 과정을 어기는 것은 디버깅 실패로 본다.
32
33
 
@@ -64,6 +65,38 @@ user-invocable: false
64
65
 
65
66
  반드시 아래 순서로 진행한다.
66
67
 
68
+ ### Phase 0. Blocker Triage (Pre-Debug Gate)
69
+
70
+ **Trigger**: When any external dependency, tool, or resource appears unavailable.
71
+
72
+ Before declaring a task blocked or unsolvable, exhaust this checklist:
73
+
74
+ | # | Workaround Path | Check |
75
+ |---|----------------|-------|
76
+ | 1 | Environment bypass | Can the dependency be bypassed in the current environment? |
77
+ | 2 | Alternative tool | Is there an alternative tool, library, or approach? |
78
+ | 3 | Partial solution | Can the task be partially completed without the dependency? |
79
+ | 4 | Install/configure | Can the dependency be installed or configured now? |
80
+ | 5 | Existing credentials | Are related tokens, auth files, or configs already present? |
81
+
82
+ **Rules**:
83
+ - Minimum 3 workaround paths MUST be explored before declaring "blocked"
84
+ - Each explored path must be documented with outcome
85
+ - "Session unsolvable" declarations MUST include the list of attempted workaround paths
86
+ - If a workaround is found, proceed with debugging using that workaround
87
+
88
+ **Output format**:
89
+ ```
90
+ [Blocker Triage]
91
+ ├── Dependency: {what is unavailable}
92
+ ├── Path 1: {attempted} → {outcome}
93
+ ├── Path 2: {attempted} → {outcome}
94
+ ├── Path 3: {attempted} → {outcome}
95
+ └── Verdict: {proceed with workaround N | genuinely blocked — reason}
96
+ ```
97
+
98
+ If verdict is "genuinely blocked", escalate to user with full triage report. Do NOT silently abandon the task.
99
+
67
100
  ### Phase 1. Define The Problem
68
101
 
69
102
  먼저 문제를 축약한다.
@@ -286,3 +319,14 @@ This skill includes reference documents for specific debugging techniques:
286
319
  - `condition-based-waiting.md` — Replacing arbitrary delays with condition-based polling
287
320
  - `find-polluter.sh` — Bisection script for finding test pollution sources
288
321
  - `condition-based-waiting-example.ts` — Complete implementation of condition-based waiting utilities
322
+
323
+ ## Extended Phases
324
+
325
+ These phase guides are mandatory when the debugging shape matches the trigger:
326
+
327
+ | Phase guide | Trigger | Gate |
328
+ |-------------|---------|------|
329
+ | `phases/timeline-correlation.md` | Incident timing, deployment timing, or config drift may explain the failure | Correlate event time against code, deploy, config, data, and dependency timelines before patching. |
330
+ | `phases/retry-cache-timeout-audit.md` | Proposed fix changes retry, cache, timeout, pooling, or backoff behavior | Prove the change fixes the root cause rather than suppressing symptoms. |
331
+ | `phases/amplification-detection.md` | Traffic spikes, retry storms, queue growth, or cascading failures are possible | Identify amplification loops before increasing capacity or broadening retries. |
332
+ | `phases/fault-injection.md` | The fix claims resilience against external failure modes | Inject the fault in a bounded environment and verify predicted behavior. |
@@ -0,0 +1,25 @@
1
+ # Amplification Detection Phase
2
+
3
+ Use this phase when the failure may cascade: retries, queues, background jobs, fan-out calls, polling loops, webhook delivery, cron overlap, or connection pools.
4
+
5
+ ## Required Checks
6
+
7
+ 1. Identify the trigger that starts the loop or fan-out.
8
+ 2. Count how many downstream operations one failing input can create.
9
+ 3. Check retry/backoff behavior and whether retries duplicate side effects.
10
+ 4. Check queue depth, worker concurrency, pool limits, and timeout alignment.
11
+ 5. Verify cancellation, dedupe, idempotency, and dead-letter behavior.
12
+
13
+ ## Output
14
+
15
+ ```text
16
+ Amplification:
17
+ - Trigger:
18
+ - Fan-out factor:
19
+ - Retry behavior:
20
+ - Shared limit affected:
21
+ - Dedupe/idempotency:
22
+ - Verdict: {amplification present | no amplification evidence}
23
+ ```
24
+
25
+ If amplification is present, stop widening retries or capacity until the loop has an owner and a guard.
@@ -0,0 +1,31 @@
1
+ # Fault Injection Phase
2
+
3
+ Use this phase when a fix claims resilience against dependency failure, network failure, timeout, cancellation, corrupt input, clock skew, partial writes, or process restart.
4
+
5
+ ## Preconditions
6
+
7
+ - The injected fault is bounded to local, test, or staging scope.
8
+ - The expected behavior is written before running the injection.
9
+ - Rollback is known and immediate.
10
+
11
+ ## Procedure
12
+
13
+ 1. State the fault and predicted behavior.
14
+ 2. Inject the smallest fault that exercises the claim.
15
+ 3. Record logs, exit code, response, retries, and cleanup behavior.
16
+ 4. Remove the fault and verify recovery.
17
+ 5. Convert the injection into a repeatable test when practical.
18
+
19
+ ## Output
20
+
21
+ ```text
22
+ Fault Injection:
23
+ - Fault:
24
+ - Prediction:
25
+ - Injection method:
26
+ - Observed behavior:
27
+ - Recovery:
28
+ - Verdict: {claim proven | claim rejected | more instrumentation needed}
29
+ ```
30
+
31
+ Do not run destructive or production fault injection without explicit authority.
@@ -0,0 +1,27 @@
1
+ # Retry, Cache, Timeout Audit
2
+
3
+ Use this phase before changing retries, caches, timeouts, pools, backoff, debounce, or rate limits.
4
+
5
+ ## Hard Gate
6
+
7
+ A retry/cache/timeout change is invalid unless it explains why the original failure happened and proves the new behavior removes the root cause rather than hiding the symptom.
8
+
9
+ ## Audit Questions
10
+
11
+ 1. Is the proposed change reducing visible error rate without proving the failing operation now succeeds?
12
+ 2. Could it increase load, fan-out, duplicate side effects, or queue latency?
13
+ 3. Does it make the failure slower and harder to observe?
14
+ 4. Is the old timeout/cache/retry value actually wrong for the measured dependency behavior?
15
+ 5. Is there a smaller root-cause fix in input validation, ownership, ordering, or lifecycle?
16
+
17
+ ## Acceptable Evidence
18
+
19
+ - Before/after traces showing the same request now reaches the intended success path.
20
+ - Load or retry-count evidence proving amplification does not increase.
21
+ - A failing guard that fails before the root-cause fix and passes after it.
22
+
23
+ ## Rejection Pattern
24
+
25
+ ```text
26
+ Rejected: increased timeout/cache/retry | only suppresses the symptom; root cause remains unproven
27
+ ```
@@ -0,0 +1,26 @@
1
+ # Timeline Correlation Phase
2
+
3
+ Use this phase when a failure has a meaningful time dimension: deployment time, config change time, traffic shift, data import, queue spike, cron run, dependency incident, or first customer report.
4
+
5
+ ## Required Steps
6
+
7
+ 1. Record the incident window in UTC and local time if available.
8
+ 2. List code, deploy, config, data, dependency, and traffic events around that window.
9
+ 3. Mark each event as before, during, or after first failure.
10
+ 4. Prefer events that happened before the first failure and changed the failing path.
11
+ 5. Write one falsifiable hypothesis that connects timing evidence to the symptom.
12
+
13
+ ## Output
14
+
15
+ ```text
16
+ Timeline:
17
+ - First failure:
18
+ - Code/deploy events:
19
+ - Config/data/dependency events:
20
+ - Traffic or cron events:
21
+
22
+ Hypothesis:
23
+ <single root-cause hypothesis tied to the timeline>
24
+ ```
25
+
26
+ Do not patch from chronology alone. Use the timeline to choose the next evidence-gathering step.
@@ -15,7 +15,13 @@
15
15
  # "rate_limits": { (v2.1.80+, optional)
16
16
  # "five_hour": { "used_percentage": 10, "resets_at": 1773979200 },
17
17
  # "seven_day": { "used_percentage": 90, "resets_at": 1773979200 }
18
- # }
18
+ # },
19
+ # "gh": { (v2.1.145+, optional)
20
+ # "repo": "owner/repo",
21
+ # "pr_number": 160,
22
+ # "pr_state": "OPEN"
23
+ # },
24
+ # "agents": [ ... ] (v2.1.144+, optional)
19
25
  # }
20
26
 
21
27
  # ---------------------------------------------------------------------------
@@ -61,14 +67,15 @@ fi
61
67
 
62
68
  # Debug logging for CTX investigation
63
69
  if [[ -n "${STATUSLINE_DEBUG}" ]]; then
64
- printf '%s\n' "$json" >> "/tmp/.claude-statusline-debug-${PPID}.jsonl"
70
+ printf '%s\n' "$json" >> "/tmp/.codex-statusline-debug-${PPID}.jsonl"
65
71
  fi
66
72
 
67
73
  # ---------------------------------------------------------------------------
68
74
  # 4. Single jq call — extract all fields as TSV
69
- # Fields: model_name, project_dir, ctx_pct, ctx_size, cost_usd, rl_5h_pct, rl_7d_pct, rl_5h_resets, rl_7d_resets
75
+ # Fields: model_name, project_dir, ctx_pct, ctx_size, cost_usd, rl_5h_pct, rl_7d_pct,
76
+ # rl_5h_resets, rl_7d_resets, gh_repo, gh_pr_number, gh_pr_state, agent_count
70
77
  # ---------------------------------------------------------------------------
71
- IFS=$'\t' read -r model_name project_dir ctx_pct ctx_size cost_usd rl_5h_pct rl_7d_pct rl_5h_resets rl_7d_resets <<< "$(
78
+ IFS=$'\t' read -r model_name project_dir ctx_pct ctx_size cost_usd rl_5h_pct rl_7d_pct rl_5h_resets rl_7d_resets gh_repo gh_pr_number gh_pr_state agent_count <<< "$(
72
79
  printf '%s' "$json" | jq -r '[
73
80
  (.model.display_name // "unknown"),
74
81
  (.workspace.current_dir // ""),
@@ -78,14 +85,25 @@ IFS=$'\t' read -r model_name project_dir ctx_pct ctx_size cost_usd rl_5h_pct rl_
78
85
  (.rate_limits.five_hour.used_percentage // -1),
79
86
  (.rate_limits.seven_day.used_percentage // -1),
80
87
  (.rate_limits.five_hour.resets_at // -1),
81
- (.rate_limits.seven_day.resets_at // -1)
88
+ (.rate_limits.seven_day.resets_at // -1),
89
+ (if (.gh.repo // "") == "" then "_" else .gh.repo end),
90
+ (if (.gh.pr_number // "") == "" then "_" else (.gh.pr_number | tostring) end),
91
+ (if (.gh.pr_state // "") == "" then "_" else .gh.pr_state end),
92
+ (if (.agents | type) == "array" then (.agents | length) else 0 end)
82
93
  ] | @tsv'
83
94
  )"
84
95
 
96
+ [[ "$gh_repo" == "_" ]] && gh_repo=""
97
+ [[ "$gh_pr_number" == "_" ]] && gh_pr_number=""
98
+ [[ "$gh_pr_state" == "_" ]] && gh_pr_state=""
99
+ if ! [[ "$agent_count" =~ ^[0-9]+$ ]]; then
100
+ agent_count=0
101
+ fi
102
+
85
103
  # ---------------------------------------------------------------------------
86
104
  # 4b. Cost & context data bridge — write to temp file for hooks
87
105
  # ---------------------------------------------------------------------------
88
- COST_BRIDGE_FILE="/tmp/.claude-cost-${PPID}"
106
+ COST_BRIDGE_FILE="/tmp/.codex-cost-${PPID}"
89
107
  _tmp="${COST_BRIDGE_FILE}.tmp.$$"
90
108
  printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "$cost_usd" "$ctx_pct" "$(date +%s)" "$rl_5h_pct" "$rl_7d_pct" "$rl_5h_resets" "$rl_7d_resets" > "$_tmp" 2>/dev/null && mv -f "$_tmp" "$COST_BRIDGE_FILE" 2>/dev/null || true
91
109
 
@@ -232,7 +250,12 @@ fi
232
250
  # 8. PR number — cached by branch to avoid gh call on every refresh
233
251
  # ---------------------------------------------------------------------------
234
252
  pr_display=""
235
- if [[ -n "$git_branch" ]] && command -v gh >/dev/null 2>&1; then
253
+ if [[ -n "$gh_pr_number" ]]; then
254
+ pr_display="PR #${gh_pr_number}"
255
+ if [[ -n "$gh_pr_state" && "$gh_pr_state" != "OPEN" ]]; then
256
+ pr_display="${pr_display} ${gh_pr_state}"
257
+ fi
258
+ elif [[ -n "$git_branch" ]] && command -v gh >/dev/null 2>&1; then
236
259
  cache_file="/tmp/statusline-pr-${project_name}"
237
260
  cached_branch=""
238
261
  cached_pr=""
@@ -360,6 +383,12 @@ if [[ -n "$wl_display" ]]; then
360
383
  wl_segment=" | ${wl_color}${wl_display}${COLOR_RESET}"
361
384
  fi
362
385
 
386
+ # Build the active agent count segment from statusline JSON when available.
387
+ agent_segment=""
388
+ if [[ "$agent_count" -gt 0 ]]; then
389
+ agent_segment=" | A:${agent_count}"
390
+ fi
391
+
363
392
  # Build the RTK segment from the session-env bridge if available.
364
393
  rtk_segment=""
365
394
  env_status_file="/tmp/.codex-env-status-${PPID}"
@@ -380,22 +409,24 @@ if [[ -f "$env_status_file" ]]; then
380
409
  fi
381
410
 
382
411
  if [[ -n "$git_branch" ]]; then
383
- printf "${cost_color}%s${COLOR_RESET} | %s | %s%s%s%s%s | ${ctx_color}%s${COLOR_RESET}\n" \
412
+ printf "${cost_color}%s${COLOR_RESET} | %s | %s%s%s%s%s%s | ${ctx_color}%s${COLOR_RESET}\n" \
384
413
  "$cost_display" \
385
414
  "$project_name" \
386
415
  "$branch_display" \
387
416
  "$pr_segment" \
388
417
  "$rl_segment" \
389
418
  "$wl_segment" \
419
+ "$agent_segment" \
390
420
  "$rtk_segment" \
391
421
  "$ctx_display"
392
422
  else
393
- printf "${cost_color}%s${COLOR_RESET} | %s%s%s%s%s | ${ctx_color}%s${COLOR_RESET}\n" \
423
+ printf "${cost_color}%s${COLOR_RESET} | %s%s%s%s%s%s | ${ctx_color}%s${COLOR_RESET}\n" \
394
424
  "$cost_display" \
395
425
  "$project_name" \
396
426
  "$pr_segment" \
397
427
  "$rl_segment" \
398
428
  "$wl_segment" \
429
+ "$agent_segment" \
399
430
  "$rtk_segment" \
400
431
  "$ctx_display"
401
432
  fi
@@ -135,7 +135,7 @@ project/
135
135
  | +-- contexts/ # Context files (ecomode)
136
136
  +-- .agents/
137
137
  | +-- skills/ # Installed skills (123 directories)
138
- +-- guides/ # Reference docs (48 topics)
138
+ +-- guides/ # Reference docs (50 topics)
139
139
  ```
140
140
 
141
141
  ## Orchestration
@@ -135,7 +135,7 @@ project/
135
135
  | +-- contexts/ # 컨텍스트 파일 (ecomode)
136
136
  +-- .agents/
137
137
  | +-- skills/ # 설치된 스킬 (123 디렉토리)
138
- +-- guides/ # 레퍼런스 문서 (48 토픽)
138
+ +-- guides/ # 레퍼런스 문서 (50 토픽)
139
139
  ```
140
140
 
141
141
  ## 오케스트레이션
@@ -120,7 +120,7 @@ project/
120
120
  | +-- contexts/ # 컨텍스트 파일 (ecomode)
121
121
  +-- .agents/
122
122
  | +-- skills/ # 스킬 (123 디렉토리)
123
- +-- guides/ # 레퍼런스 문서 (48 토픽)
123
+ +-- guides/ # 레퍼런스 문서 (50 토픽)
124
124
  ```
125
125
 
126
126
  ## 오케스트레이션
@@ -137,7 +137,7 @@ project/
137
137
  | +-- rules/ # Global rules (22 files)
138
138
  | +-- hooks/ # Hook scripts (security, validation, HUD)
139
139
  | +-- contexts/ # Context files (4 files)
140
- +-- guides/ # Reference docs (48 topics)
140
+ +-- guides/ # Reference docs (50 topics)
141
141
  ```
142
142
 
143
143
  ## Orchestration
@@ -137,7 +137,7 @@ project/
137
137
  | +-- rules/ # 전역 규칙 (22 파일)
138
138
  | +-- hooks/ # 훅 스크립트 (보안, 검증, HUD)
139
139
  | +-- contexts/ # 컨텍스트 파일 (4 파일)
140
- +-- guides/ # 레퍼런스 문서 (48 토픽)
140
+ +-- guides/ # 레퍼런스 문서 (50 토픽)
141
141
  ```
142
142
 
143
143
  ## 오케스트레이션
@@ -48,11 +48,11 @@ templates/
48
48
  | +-- agents/ # agent definitions (49 files)
49
49
  | +-- skills/ # skill modules (123 SKILL.md files)
50
50
  | +-- rules/ # global rules (22 files)
51
- | +-- hooks/ # hook registry and scripts (38 scripts)
51
+ | +-- hooks/ # hook registry and scripts (40 scripts)
52
52
  | +-- contexts/ # context files
53
53
  | +-- ontology/ # ontology and routing metadata
54
54
  | +-- schemas/ # tool input schemas
55
- +-- guides/ # reference docs (48 topics)
55
+ +-- guides/ # reference docs (50 topics)
56
56
  ```
57
57
 
58
58
  ## Components
@@ -77,13 +77,13 @@ Reusable workflow and reference skill modules. During Codex installation these l
77
77
 
78
78
  Global agent behavior rules. During Codex installation these land under `.codex/rules/`.
79
79
 
80
- ### Guides (48)
80
+ ### Guides (50)
81
81
 
82
82
  `templates/guides/*/`
83
83
 
84
84
  Reference documentation directories copied to installed projects as `guides/`.
85
85
 
86
- ### Hooks (38)
86
+ ### Hooks (40)
87
87
 
88
88
  `templates/.claude/hooks/scripts/*.sh`
89
89
 
@@ -0,0 +1,53 @@
1
+ # Agent Teams Shutdown and tmux Fallback Troubleshooting
2
+
3
+ This guide ports the old Claude Code shutdown flow into Codex/OMX terms. Use it when an Agent Teams session stops making forward progress during shutdown, cleanup, or handoff.
4
+
5
+ ## Typical Failure Signs
6
+
7
+ | Symptom | Likely cause | Action |
8
+ | --- | --- | --- |
9
+ | `TeamDelete` refuses to complete | One or more members are still active | Send a final shutdown request, then retry once |
10
+ | Idle notifications repeat without exit | A member saw the request but did not stop | Wait briefly, then fall back to stale-session cleanup |
11
+ | The team looks done but the pane is still attached | The worker is still owned by tmux | Reclaim the owned tmux pane or session before declaring cleanup complete |
12
+ | Progress stops after a member blocks | The member is waiting on a dependency | Reassign or wait silently instead of polling forever |
13
+
14
+ ## Recovery Order
15
+
16
+ 1. Send one explicit shutdown message to the team member or team lead.
17
+ 2. Wait for a short, fixed interval.
18
+ 3. Try `TeamDelete` again.
19
+ 4. If `TeamDelete` still fails and the session is clearly stale, clean up the owned tmux pane or session.
20
+ 5. Re-check `.omx/state/` and confirm the active mode is gone.
21
+
22
+ ## Fallback Rules
23
+
24
+ - Prefer graceful shutdown first: `SendMessage` with a shutdown request, then `TeamDelete`.
25
+ - Use tmux fallback only for stale local cleanup, not as the default path.
26
+ - Do not kill a pane or session that still contains live user work.
27
+ - After fallback cleanup, clear any stale `omx` runtime state that still claims the team is active.
28
+
29
+ ## Codex/OMX Surface Map
30
+
31
+ | Need | Default surface | Compatibility note |
32
+ | --- | --- | --- |
33
+ | Ask the team to stop | `SendMessage` | Legacy Claude Code shutdown flows may use analogous `/bg` or background-session signals |
34
+ | Remove a finished team | `TeamDelete` | Treat refusal as a state problem, not as permission to spin forever |
35
+ | Kill a stale worker pane | OMX-managed `tmux` session or pane | Claude-specific socket names are compatibility-only references |
36
+ | Clear lingering session state | `.omx/state/` and related runtime files | Do not rely on the pane alone as the source of truth |
37
+
38
+ ## Example Recovery Sequence
39
+
40
+ ```text
41
+ 1. SendMessage(team-member, "shutdown request")
42
+ 2. Wait for the member to stop producing work
43
+ 3. TeamDelete(team)
44
+ 4. If TeamDelete still reports active members and the session is stale, kill the owned tmux pane
45
+ 5. Re-run the state check and confirm no active OMX mode remains
46
+ ```
47
+
48
+ ## Escalate When
49
+
50
+ - The pane or session is not owned by the current task.
51
+ - Cleanup would interrupt active user work.
52
+ - The same stale team keeps reappearing after cleanup.
53
+ - A shared infra tmux socket or background process is involved.
@@ -0,0 +1,43 @@
1
+ # Autonomous Challenge Lessons
2
+
3
+ This guide captures repeatable lessons from long autonomous runs where the agent must inspect an existing challenge environment, produce a fix, and verify the result without frequent human steering.
4
+
5
+ ## Start With Ground Truth
6
+
7
+ Before implementing a guessed mechanism, check whether the environment already contains an answer artifact, compiled fix, reference binary, fixture, or expected-output file.
8
+
9
+ Required first-pass questions:
10
+
11
+ 1. Is there a supplied fix artifact, golden output, or reference implementation?
12
+ 2. Which runtime version and mapping namespace are actually present?
13
+ 3. Which identifiers are proven by code inspection rather than inferred from memory?
14
+ 4. Which launcher or environment flags are being used, and what do they mean?
15
+
16
+ ## Repeated Failure Discipline
17
+
18
+ If the same critical error appears twice, stop repeating the launch or tool call. Re-check the option, permission, process state, or single-instance constraint that may make the command invalid.
19
+
20
+ Examples:
21
+
22
+ - Tool permission denial: do not repeat the exact same tool call; switch evidence path.
23
+ - Launcher flag failure: read the flag meaning before another launch.
24
+ - Single-instance process collision: check and clean the process state before relaunch.
25
+ - Background command output loss: locate the output file or rerun through a managed log path.
26
+
27
+ ## Parallel Work Heuristic
28
+
29
+ When a single command is about to process dozens of independent files, downloads, or checks, split it into bounded parallel lanes instead of making one long opaque shell run.
30
+
31
+ Use this when:
32
+
33
+ - There are about 30 or more independent units.
34
+ - Failures can be isolated by chunk.
35
+ - Results can be merged deterministically.
36
+
37
+ ## QA Evidence
38
+
39
+ QA reports must quote identifiers from the target code before using them. Selectors, `data-testid` values, mapping names, CLI flags, and config keys are not valid unless read or grepped from the project.
40
+
41
+ ## GUI Verification
42
+
43
+ For visual or interactive tasks, collect direct browser, screenshot, or runtime evidence when possible. If only indirect evidence is available, label it as indirect and explain what could not be captured.