oh-my-customcodex 0.5.1 → 0.5.2

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 (40) 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 +11 -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-tool-identification.md +19 -0
  21. package/templates/.claude/rules/SHOULD-memory-integration.md +7 -2
  22. package/templates/.claude/skills/systematic-debugging/SKILL.md +44 -0
  23. package/templates/.claude/skills/systematic-debugging/phases/amplification-detection.md +25 -0
  24. package/templates/.claude/skills/systematic-debugging/phases/fault-injection.md +31 -0
  25. package/templates/.claude/skills/systematic-debugging/phases/retry-cache-timeout-audit.md +27 -0
  26. package/templates/.claude/skills/systematic-debugging/phases/timeline-correlation.md +26 -0
  27. package/templates/.claude/statusline.sh +40 -9
  28. package/templates/AGENTS.md.en +1 -1
  29. package/templates/AGENTS.md.ko +1 -1
  30. package/templates/CLAUDE.md +1 -1
  31. package/templates/CLAUDE.md.en +1 -1
  32. package/templates/CLAUDE.md.ko +1 -1
  33. package/templates/README.md +4 -4
  34. package/templates/guides/agent-teams/troubleshooting.md +53 -0
  35. package/templates/guides/autonomous-challenge-lessons/README.md +43 -0
  36. package/templates/guides/claude-code/15-version-compatibility.md +51 -0
  37. package/templates/guides/claude-code-tracking.md +51 -0
  38. package/templates/guides/index.yaml +12 -0
  39. package/templates/manifest.json +3 -3
  40. package/templates/tests/tsconfig.json +7 -0
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env bash
2
+ # agent-capability-precheck.sh — R010 capability gate for Agent/Task spawns
3
+ #
4
+ # Blocks delegation when the prompt asks for shell/GitHub work but the target
5
+ # agent frontmatter does not allow Bash, or explicitly disallows it.
6
+
7
+ set +e
8
+
9
+ input="$(cat)"
10
+
11
+ json_string_field() {
12
+ local jq_expr="$1"
13
+ local key="$2"
14
+
15
+ if command -v jq >/dev/null 2>&1; then
16
+ printf '%s' "$input" | jq -r "$jq_expr" 2>/dev/null
17
+ return
18
+ fi
19
+
20
+ printf '%s' "$input" | sed -nE "s/.*\"${key}\"[[:space:]]*:[[:space:]]*\"([^\"]*)\".*/\\1/p" | head -n 1
21
+ }
22
+
23
+ agent_type="$(json_string_field '.tool_input.subagent_type // .tool_input.agent_type // .agent_type // empty' 'subagent_type')"
24
+ if [[ -z "$agent_type" ]]; then
25
+ agent_type="$(json_string_field '.tool_input.agent_type // .agent_type // empty' 'agent_type')"
26
+ fi
27
+ prompt="$(json_string_field '.tool_input.prompt // .tool_input.description // .prompt // .description // empty' 'prompt')"
28
+ if [[ -z "$prompt" ]]; then
29
+ prompt="$(json_string_field '.tool_input.description // .description // empty' 'description')"
30
+ fi
31
+
32
+ if [[ -z "$agent_type" || -z "$prompt" ]]; then
33
+ printf '%s' "$input"
34
+ exit 0
35
+ fi
36
+
37
+ shell_pattern='(^|[^[:alnum:]_-])(bash|shell|command|execute|run|gh|git|npm|pnpm|yarn|bun|python|node|curl|jq|sed|awk|make|docker)([[:space:]:;,.]|$)'
38
+ if ! printf '%s' "$prompt" | grep -Eiq "$shell_pattern"; then
39
+ printf '%s' "$input"
40
+ exit 0
41
+ fi
42
+
43
+ agent_file=""
44
+ for candidate in \
45
+ ".codex/agents/${agent_type}.md" \
46
+ "templates/.claude/agents/${agent_type}.md" \
47
+ ".claude/agents/${agent_type}.md"
48
+ do
49
+ if [[ -f "$candidate" ]]; then
50
+ agent_file="$candidate"
51
+ break
52
+ fi
53
+ done
54
+
55
+ if [[ -z "$agent_file" ]]; then
56
+ echo "[Hook] Agent capability pre-check: no frontmatter found for ${agent_type}; proceeding advisory-only" >&2
57
+ printf '%s' "$input"
58
+ exit 0
59
+ fi
60
+
61
+ frontmatter="$(awk '
62
+ BEGIN { in_fm = 0; seen = 0 }
63
+ /^---[[:space:]]*$/ {
64
+ if (seen == 0) { in_fm = 1; seen = 1; next }
65
+ if (in_fm == 1) { exit }
66
+ }
67
+ in_fm == 1 { print }
68
+ ' "$agent_file")"
69
+
70
+ has_bash_tool="$(printf '%s\n' "$frontmatter" | awk '
71
+ /^tools:[[:space:]]*$/ { in_tools = 1; next }
72
+ /^[^[:space:]-][^:]*:/ { in_tools = 0 }
73
+ in_tools == 1 && /^[[:space:]]*-[[:space:]]*Bash[[:space:]]*$/ { found = 1 }
74
+ END { print found ? "yes" : "no" }
75
+ ')"
76
+
77
+ disallows_bash="no"
78
+ if printf '%s\n' "$frontmatter" | grep -Eq '^disallowedTools:[[:space:]]*\[[^]]*Bash[^]]*\]'; then
79
+ disallows_bash="yes"
80
+ elif printf '%s\n' "$frontmatter" | awk '
81
+ /^disallowedTools:[[:space:]]*$/ { in_disallowed = 1; next }
82
+ /^[^[:space:]-][^:]*:/ { in_disallowed = 0 }
83
+ in_disallowed == 1 && /^[[:space:]]*-[[:space:]]*Bash[[:space:]]*$/ { found = 1 }
84
+ END { exit found ? 0 : 1 }
85
+ '; then
86
+ disallows_bash="yes"
87
+ fi
88
+
89
+ if [[ "$has_bash_tool" != "yes" || "$disallows_bash" == "yes" ]]; then
90
+ echo "[Hook] BLOCKED: Agent capability mismatch for '${agent_type}'" >&2
91
+ echo "[Hook] Prompt appears to require shell/GitHub/command execution, but ${agent_file} does not allow Bash." >&2
92
+ if [[ "$disallows_bash" == "yes" ]]; then
93
+ echo "[Hook] The agent frontmatter explicitly lists disallowedTools: Bash." >&2
94
+ fi
95
+ echo "[Hook] Re-route command work to a Bash-capable agent, or pre-collect command output before delegating." >&2
96
+ exit 2
97
+ fi
98
+
99
+ printf '%s' "$input"
@@ -6,10 +6,21 @@
6
6
 
7
7
  set -euo pipefail
8
8
 
9
- command -v jq >/dev/null 2>&1 || exit 0
10
-
11
9
  input=$(cat)
12
- mode=$(echo "$input" | jq -r '.tool_input.mode // ""')
10
+
11
+ json_string_field() {
12
+ local jq_expr="$1"
13
+ local key="$2"
14
+
15
+ if command -v jq >/dev/null 2>&1; then
16
+ echo "$input" | jq -r "$jq_expr" 2>/dev/null
17
+ return
18
+ fi
19
+
20
+ echo "$input" | sed -nE "s/.*\"${key}\"[[:space:]]*:[[:space:]]*\"([^\"]*)\".*/\\1/p" | head -n 1
21
+ }
22
+
23
+ mode=$(json_string_field '.tool_input.mode // ""' 'mode')
13
24
 
14
25
  if [ "$mode" != "bypassPermissions" ]; then
15
26
  echo "[Hook] BLOCKED: Agent/Task spawn missing required mode: \"bypassPermissions\"" >&2
@@ -9,13 +9,22 @@
9
9
  # Pattern: /tmp/.codex-{purpose}-${PPID}
10
10
  # See also: agent-teams-advisor.sh, context-budget-advisor.sh, stuck-detector.sh
11
11
 
12
- # Dependency check: exit silently if jq not available
13
- command -v jq >/dev/null 2>&1 || exit 0
14
-
15
12
  input=$(cat)
16
13
 
17
- agent_type=$(echo "$input" | jq -r '.tool_input.subagent_type // ""')
18
- prompt=$(echo "$input" | jq -r '.tool_input.prompt // ""')
14
+ json_string_field() {
15
+ local jq_expr="$1"
16
+ local key="$2"
17
+
18
+ if command -v jq >/dev/null 2>&1; then
19
+ echo "$input" | jq -r "$jq_expr" 2>/dev/null
20
+ return
21
+ fi
22
+
23
+ echo "$input" | sed -nE "s/.*\"${key}\"[[:space:]]*:[[:space:]]*\"([^\"]*)\".*/\\1/p" | head -n 1
24
+ }
25
+
26
+ agent_type=$(json_string_field '.tool_input.subagent_type // ""' 'subagent_type')
27
+ prompt=$(json_string_field '.tool_input.prompt // ""' 'prompt')
19
28
 
20
29
  # R010 violation tracking file (PPID-scoped for session persistence)
21
30
  VIOLATION_FILE="/tmp/.codex-r010-violations-${PPID}"
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env bash
2
+ # plugin-cache-check.sh - SessionStart advisory hook.
3
+ # Detects plugin cache packages with package.json but missing node_modules.
4
+ # Always exits 0. Output advisory to stderr only.
5
+
6
+ set -euo pipefail
7
+
8
+ input=$(cat)
9
+
10
+ cache_roots=()
11
+ if [ -n "${CODEX_PLUGIN_CACHE:-}" ]; then
12
+ cache_roots+=("$CODEX_PLUGIN_CACHE")
13
+ fi
14
+ if [ -n "${CLAUDE_PLUGIN_CACHE:-}" ]; then
15
+ cache_roots+=("$CLAUDE_PLUGIN_CACHE")
16
+ fi
17
+ cache_roots+=("${HOME}/.codex/plugins/cache")
18
+ cache_roots+=("${HOME}/.claude/shared-plugins/cache")
19
+
20
+ missing=()
21
+ for cache_root in "${cache_roots[@]}"; do
22
+ if [ ! -d "$cache_root" ]; then
23
+ continue
24
+ fi
25
+
26
+ while IFS= read -r package_json; do
27
+ package_dir=$(dirname "$package_json")
28
+ if [ ! -d "$package_dir/node_modules" ]; then
29
+ missing+=("$package_dir")
30
+ fi
31
+ done < <(find "$cache_root" -maxdepth 5 -name package.json 2>/dev/null)
32
+ done
33
+
34
+ if [ "${#missing[@]}" -gt 0 ]; then
35
+ echo "[Advisory] Plugin cache missing node_modules (run \`(cd <dir> && bun install)\` per directory):" >&2
36
+ for dir in "${missing[@]}"; do
37
+ echo " - $dir" >&2
38
+ done
39
+ fi
40
+
41
+ echo "$input"
42
+ exit 0
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env bash
2
+ # session-reflection.sh — Stop/SubagentStop advisory reflection capture
3
+ #
4
+ # Records lightweight session-end evidence from Claude/Codex hook input. The
5
+ # hook never blocks shutdown; it writes a markdown reflection when transcript,
6
+ # background task, or session cron evidence is available.
7
+
8
+ set +e
9
+
10
+ input="$(cat)"
11
+ project_root="${OMCUSTOMCODEX_PROJECT_ROOT:-${OMCODEX_PROJECT_ROOT:-$PWD}}"
12
+
13
+ pass_through() {
14
+ printf '%s' "$input"
15
+ exit 0
16
+ }
17
+
18
+ case "${OMCUSTOMCODEX_SESSION_REFLECTION:-${OMCODEX_SESSION_REFLECTION:-${OMCUSTOM_SESSION_REFLECTION:-on}}}" in
19
+ off|false|0|no)
20
+ pass_through
21
+ ;;
22
+ esac
23
+
24
+ json_get() {
25
+ local expr="$1"
26
+ local fallback_key="$2"
27
+
28
+ if command -v jq >/dev/null 2>&1; then
29
+ printf '%s' "$input" | jq -r "$expr" 2>/dev/null
30
+ return
31
+ fi
32
+
33
+ # Minimal fallback for flat string fields when jq is unavailable.
34
+ printf '%s' "$input" | sed -nE "s/.*\"${fallback_key}\"[[:space:]]*:[[:space:]]*\"([^\"]*)\".*/\\1/p" | head -n 1
35
+ }
36
+
37
+ session_id="$(json_get '.session_id // .sessionId // empty' 'session_id')"
38
+ transcript_path="$(json_get '.transcript_path // .conversation_transcript_path // .transcript.path // .transcript.file_path // empty' 'transcript_path')"
39
+
40
+ if command -v jq >/dev/null 2>&1; then
41
+ background_task_count="$(printf '%s' "$input" | jq -r '[.background_tasks[]?] | length' 2>/dev/null)"
42
+ session_cron_count="$(printf '%s' "$input" | jq -r '[.session_crons[]?] | length' 2>/dev/null)"
43
+ background_task_lines="$(printf '%s' "$input" | jq -r '.background_tasks[]? | "- " + ((.id // .task_id // "task") | tostring) + " [" + ((.status // .state // "unknown") | tostring) + "] " + ((.command // .description // .prompt // "") | tostring)' 2>/dev/null)"
44
+ session_cron_lines="$(printf '%s' "$input" | jq -r '.session_crons[]? | "- " + ((.id // .name // "cron") | tostring) + " [" + ((.status // .state // "unknown") | tostring) + "] " + ((.command // .description // .schedule // "") | tostring)' 2>/dev/null)"
45
+ else
46
+ background_task_count=0
47
+ session_cron_count=0
48
+ background_task_lines=""
49
+ session_cron_lines=""
50
+ fi
51
+
52
+ if ! [[ "$background_task_count" =~ ^[0-9]+$ ]]; then
53
+ background_task_count=0
54
+ fi
55
+ if ! [[ "$session_cron_count" =~ ^[0-9]+$ ]]; then
56
+ session_cron_count=0
57
+ fi
58
+
59
+ if [[ -z "$transcript_path" && -n "$session_id" ]]; then
60
+ transcript_base="${OMCUSTOMCODEX_TRANSCRIPT_BASE:-${OMCODEX_TRANSCRIPT_BASE:-${OMCUSTOM_TRANSCRIPT_BASE:-${HOME}/.codex/projects}}}"
61
+ if [[ -d "$transcript_base" ]]; then
62
+ transcript_path="$(find "$transcript_base" -type f -name "*${session_id}*.jsonl" -print -quit 2>/dev/null)"
63
+ fi
64
+ fi
65
+
66
+ if [[ -z "$transcript_path" && "$background_task_count" -eq 0 && "$session_cron_count" -eq 0 ]]; then
67
+ pass_through
68
+ fi
69
+
70
+ out_dir="${project_root}/.codex/outputs/reflections"
71
+ mkdir -p "$out_dir" 2>/dev/null || pass_through
72
+ out_file="${out_dir}/$(date -u +%Y-%m-%d).md"
73
+
74
+ tool_uses=0
75
+ assistant_turns=0
76
+ handoff_prompts=0
77
+ if [[ -n "$transcript_path" && -f "$transcript_path" ]]; then
78
+ tool_uses="$(grep -c '"tool_use"' "$transcript_path" 2>/dev/null || echo 0)"
79
+ assistant_turns="$(grep -c '"role"[[:space:]]*:[[:space:]]*"assistant"' "$transcript_path" 2>/dev/null || echo 0)"
80
+ handoff_prompts="$(grep -Eci 'should I proceed|shall I proceed|계속할까요|진행할까요' "$transcript_path" 2>/dev/null || echo 0)"
81
+ fi
82
+
83
+ {
84
+ printf '\n## %s Session Reflection\n\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
85
+ printf -- '- Session: `%s`\n' "${session_id:-unknown}"
86
+ printf -- '- Transcript: `%s`\n' "${transcript_path:-unavailable}"
87
+ printf -- '- Tool uses observed: %s\n' "$tool_uses"
88
+ printf -- '- Assistant turns observed: %s\n' "$assistant_turns"
89
+ printf -- '- Permission-handoff prompts observed: %s\n' "$handoff_prompts"
90
+ printf -- '- Background tasks in hook input: %s\n' "$background_task_count"
91
+ printf -- '- Session crons in hook input: %s\n' "$session_cron_count"
92
+ if [[ -n "$background_task_lines" ]]; then
93
+ printf '\n### Background Tasks\n%s\n' "$background_task_lines"
94
+ fi
95
+ if [[ -n "$session_cron_lines" ]]; then
96
+ printf '\n### Session Crons\n%s\n' "$session_cron_lines"
97
+ fi
98
+ if [[ "$handoff_prompts" =~ ^[0-9]+$ && "$handoff_prompts" -gt 0 ]]; then
99
+ printf -- '\n### Follow-up\n- Review permission-handoff prompts against the autonomous execution directive.\n'
100
+ fi
101
+ } >> "$out_file" 2>/dev/null
102
+
103
+ echo "[SessionReflection] Recorded reflection: ${out_file}" >&2
104
+ echo "[SessionReflection] background_tasks=${background_task_count} session_crons=${session_cron_count}" >&2
105
+
106
+ pass_through
@@ -8,6 +8,10 @@ keep-coding-instructions: true
8
8
 
9
9
  Use Korean for user-facing communication unless the user explicitly asks otherwise. Keep code, file contents, identifiers, and commit trailers in English when that is the repository convention.
10
10
 
11
+ ## Honorific Level
12
+
13
+ Default to formal Korean 합쇼체 for user-facing prose. Use `-습니다`, `-합니다`, and `-했습니다`; avoid 반말 and casual 해요체 unless the user explicitly requests a different tone.
14
+
11
15
  Every response starts with the agent identity block required by the project guidance:
12
16
 
13
17
  ```text
@@ -9,61 +9,89 @@ Every response MUST start with agent identification:
9
9
  ```
10
10
  ┌─ Agent: {agent-name} ({agent-type})
11
11
  ├─ Skill: {skill-name} (if applicable)
12
- └─ Task: {brief-task-description}
12
+ └─ Status: {current-action-or-verdict}
13
13
  ```
14
14
 
15
- Default (no specific agent): `┌─ Agent: claude (default)`
15
+ Use `├─` for every intermediate metadata line. Only the final metadata line uses `└─`.
16
+
17
+ Default (no specific agent): `┌─ Agent: Codex (default)`
16
18
 
17
19
  ## Simplified Format
18
20
 
19
- For brief responses: `[mgr-creator] Creating agent structure...`
20
- With skill: `[fe-vercel-agent → react-best-practices] Analyzing...`
21
+ The full block is still required for brief user-facing responses. A one-line response may contain only the block plus one concise sentence, but it must not drop the block.
22
+
23
+ Legacy bracket shorthand is allowed only inside internal logs or non-user-facing scratch output:
24
+
25
+ ```
26
+ [mgr-creator] Creating agent structure...
27
+ [fe-vercel-agent → react-best-practices] Analyzing...
28
+ ```
29
+
30
+ ## Short Response Discipline
31
+
32
+ Short answers, diagnostics, status pings, and corrections are not exempt. If the response is visible to the user, start with the identity block even when the body is one sentence.
33
+
34
+ Anti-pattern:
35
+
36
+ ```text
37
+ 확인했습니다.
38
+ ```
39
+
40
+ Correct:
41
+
42
+ ```text
43
+ ┌─ Agent: Codex (default)
44
+ ├─ Skill: none
45
+ └─ Status: 확인
46
+
47
+ 확인했습니다.
48
+ ```
21
49
 
22
50
  ## Routing & Skill Context
23
51
 
24
52
  When the orchestrator uses a routing skill, identification should reflect the active context:
25
53
 
26
54
  ```
27
- ┌─ Agent: claude (secretary-routing)
55
+ ┌─ Agent: Codex (secretary-routing)
28
56
  ├─ Skill: secretary-routing
29
- └─ Task: route agent management request
57
+ └─ Status: route agent management request
30
58
  ```
31
59
 
32
60
  | Context | Identification |
33
61
  |---------|---------------|
34
- | No routing active | `claude (default)` |
35
- | secretary-routing | `claude (secretary-routing)` |
36
- | dev-lead-routing | `claude (dev-lead-routing)` |
37
- | de-lead-routing | `claude (de-lead-routing)` |
38
- | qa-lead-routing | `claude (qa-lead-routing)` |
39
- | Skill invocation | `claude → {skill-name}` |
62
+ | No routing active | `Codex (default)` |
63
+ | secretary-routing | `Codex (secretary-routing)` |
64
+ | dev-lead-routing | `Codex (dev-lead-routing)` |
65
+ | de-lead-routing | `Codex (de-lead-routing)` |
66
+ | qa-lead-routing | `Codex (qa-lead-routing)` |
67
+ | Skill invocation | `Codex → {skill-name}` |
40
68
 
41
69
  ## Skill Invocation Format
42
70
 
43
71
  When the orchestrator invokes a skill via the Skill tool, the skill name MUST be integrated into the identification block — NOT displayed as a separate tool call.
44
72
 
45
73
  ```
46
- ┌─ Agent: claude → {skill-name}
47
- └─ Task: {brief-task-description}
74
+ ┌─ Agent: Codex → {skill-name}
75
+ └─ Status: {current-action-or-verdict}
48
76
  ```
49
77
 
50
78
  ### Common Violations
51
79
 
52
80
  ```
53
81
  Incorrect: Skill as separate display
54
- ┌─ Agent: claude (default)
55
- └─ Task: research topic analysis
82
+ ┌─ Agent: Codex (default)
83
+ └─ Status: research topic analysis
56
84
 
57
85
  Skill(research) ← separate, disconnected
58
86
 
59
87
  Correct: Skill integrated into identification
60
- ┌─ Agent: claude → research
61
- └─ Task: research topic analysis
88
+ ┌─ Agent: Codex → research
89
+ └─ Status: research topic analysis
62
90
 
63
91
  Correct: With sub-skill
64
- ┌─ Agent: claude → research
92
+ ┌─ Agent: Codex → research
65
93
  ├─ Skill: result-aggregation
66
- └─ Task: aggregate team findings
94
+ └─ Status: aggregate team findings
67
95
  ```
68
96
 
69
97
  ## When to Display
@@ -72,6 +100,6 @@ Correct: With sub-skill
72
100
  |-----------|---------|
73
101
  | Agent-specific task | Full header |
74
102
  | Using skill | Include skill name |
75
- | General conversation | "claude (default)" |
103
+ | General conversation | "Codex (default)" |
76
104
  | Long tasks | Show progress with agent context |
77
- | Skill invocation | Integrated `claude → {skill-name}` format |
105
+ | Skill invocation | Integrated `Codex → {skill-name}` format |
@@ -37,14 +37,18 @@ These are distinct mechanisms. Agent Teams `SendMessage` requires `TeamCreate` a
37
37
  ## Self-Check (Before Agent Tool)
38
38
 
39
39
  Before using Agent tool for 2+ agent tasks, complete this check:
40
- Quick rule: 3+ agents OR review cycle → use Agent Teams. Sequential deps / scaffolding → Agent Tool. 2+ issues in same batch → prefer Agent Teams.
40
+ Quick rule: User explicitly preferred plain subagents this session? → use Agent Tool (R000 user instructions > R018). Otherwise: 3+ agents OR review cycle → use Agent Teams. Sequential deps / scaffolding → Agent Tool. 2+ issues in same batch → prefer Agent Teams.
41
41
 
42
42
  <!-- DETAIL: Self-Check (Before Agent Tool)
43
43
  ╔══════════════════════════════════════════════════════════════════╗
44
44
  ║ BEFORE USING Agent TOOL FOR 2+ AGENTS: ║
45
45
  ║ ║
46
+ ║ 0. Has user explicitly preferred plain subagents this session? ║
47
+ ║ YES → Use Agent tool (R000 user instructions > R018) ║
48
+ ║ NO → Continue to #1 ║
49
+ ║ ║
46
50
  ║ 1. Is Agent Teams available? ║
47
- ║ YES → check criteria #2-#4
51
+ ║ YES → check criteria #2-#5
48
52
  ║ NO → Proceed with Agent tool ║
49
53
  ║ ║
50
54
  ║ 2. Will 3+ agents be involved? ║
@@ -12,6 +12,7 @@ Before declaring any task `[Done]`, verify completion against task-type-specific
12
12
  |-----------|-------------------------------------|
13
13
  | Release | All issues closed, version bumped, PR merged, GitHub Release created; **External automation verified**: `.github/workflows/` listed AND `gh run list --limit 10` checked for auto-publish workflows |
14
14
  | Implementation | Code compiles/passes lint, tests pass (if exist), no TODO markers left |
15
+ | UI/Frontend | Screenshot or browser smoke evidence collected; text/layout does not overlap at target viewports |
15
16
  | Documentation | Links valid, counts accurate, cross-references updated |
16
17
  | Git Operations | Operation succeeded (check exit code), working tree clean |
17
18
  | Code Review | All findings addressed or explicitly deferred with justification |
@@ -70,8 +71,18 @@ Never accept "pre-existing" without direct base-branch evidence. A false "pre-ex
70
71
  | "Tests pass" | Only ran subset | Run full test suite |
71
72
  | "Waiting for manual publish" | External CI/CD auto-publishes on merge | Check `.github/workflows/` BEFORE assuming manual step |
72
73
  | "Subagent said pre-existing" | Claim not verified against base branch | Run test on base branch, compare directly |
74
+ | "User interrupted, old plan still continued" | Newer user instruction has priority | Re-rank current work against the newest user message before continuing |
73
75
  -->
74
76
 
77
+ ## Interrupt Priority Re-Ordering
78
+
79
+ When a user sends a new instruction while work is in progress, completion status must be re-evaluated against the newest message before any `[Done]` claim.
80
+
81
+ 1. If the new message conflicts with the old plan, stop or re-route the old plan.
82
+ 2. If the new message narrows scope, verify only the narrowed scope and report what was left out.
83
+ 3. If the new message adds a requirement, add it to the completion contract before closing.
84
+ 4. If no conflict exists, continue but explicitly preserve the new requirement in the next verification pass.
85
+
75
86
  ## Completion Contract Format — [Contract] + [Done] with criterion/evidence pairs. See template via Read tool.
76
87
 
77
88
  <!-- DETAIL: Completion Contract Format
@@ -33,6 +33,7 @@ Update the relevant rule rather than just acknowledging the violation.
33
33
  | Process gap (workflow hole) | ✅ | ✅ | ✅ |
34
34
  | Repeatable system bug | — | ✅ | ✅ |
35
35
  | Agent selection failure (wrong agent routed) | — | ✅ | — |
36
+ | External repository convention miss | ✅ | ✅ | ✅ |
36
37
 
37
38
  When CI failure, process gap, or repeatable system defect is found:
38
39
  1. Record feedback memory (defend current session)
@@ -48,7 +49,19 @@ When repeating agent failures or suboptimal routing is detected:
48
49
 
49
50
  This connects R016's continuous improvement loop with the adaptive-harness skill's learning capability.
50
51
 
51
- ## Anti-Patterns 4 patterns: "I'll update later", "one-time exception", "doesn't cover this", "finish task first". See table via Read tool.
52
+ ## External Repository Contribution Pre-Check
53
+
54
+ Before creating or modifying assets for an external repository or upstream contribution target, inspect that repository's local contract before implementing:
55
+
56
+ 1. Read the nearest `AGENTS.md` or equivalent agent guidance.
57
+ 2. Read `CONTRIBUTING.md`, plugin/skill authoring docs, or project-specific creation guides when present.
58
+ 3. Identify required metadata enums, naming conventions, validation commands, and forbidden paths.
59
+ 4. Add the discovered constraints to the task plan before editing.
60
+ 5. If the repo lacks guidance, state that explicitly and use the smallest conventional change.
61
+
62
+ Late discovery of contribution rules is a process defect. Record it as memory and an issue when the miss is repeatable or affected delivered work.
63
+
64
+ ## Anti-Patterns — 5 patterns: "I'll update later", "one-time exception", "doesn't cover this", "finish task first", "calibration during action-oriented tone". See table via Read tool.
52
65
 
53
66
  <!-- DETAIL: Anti-Patterns
54
67
  | Anti-Pattern | Why It's Wrong | Correct Action |
@@ -57,6 +70,7 @@ This connects R016's continuous improvement loop with the adaptive-harness skill
57
70
  | "This is a one-time exception" | Exceptions become patterns | If the rule is wrong, fix it; if it's right, follow it |
58
71
  | "The rule doesn't cover this case" | Missing coverage = rule gap | Add the case to the rule immediately |
59
72
  | "Let me finish the task first" | Rule violations compound | Fix rule first (5 min), then continue (prevents N future violations) |
73
+ | "Calibration/humility during action-oriented tone (auto mode, ㄱㄱ, 계속해)" | Self-questioning wastes time when user signals action; action-mode preempts meta-reflection | Defer calibration to post-task feedback memory; respond with short action confirmation |
60
74
  -->
61
75
 
62
76
  ## Timing — Rule updates MUST happen before continuing original task, in the same session.
@@ -39,6 +39,35 @@ Display reasoning when routing to agents. Users must always know which agent was
39
39
 
40
40
  Users can specify agent directly with `@{agent-name} {command}`. Override bypasses detection.
41
41
 
42
+ ## Git Push Continuation
43
+
44
+ If the user has already explicitly authorized `commit` or `push` in this session, that authorization persists for follow-up work in the same branch and the same change family. Do not restart confirmation just because the next step is a related doc, rule, or mirror update.
45
+
46
+ Continue without asking again when:
47
+
48
+ - the branch is unchanged
49
+ - the remote target is unchanged
50
+ - the follow-up work is the same category as the earlier approved change
51
+
52
+ Reconfirm when:
53
+
54
+ - the branch changes
55
+ - the remote changes
56
+ - the operation becomes history-rewriting or destructive (`--force`, rebase, reset, tag overwrite)
57
+ - the user narrows or revokes the earlier approval
58
+
59
+ ## Structured Question Failure Discipline
60
+
61
+ When a structured question surface (`AskUserQuestion`, `omx question`, or native structured input) is rejected, unavailable, or malformed, the orchestrator must not silently downgrade to a different workflow.
62
+
63
+ Required behavior:
64
+
65
+ 1. Treat the failed question attempt as evidence, not as user refusal.
66
+ 2. Retry once with the smallest valid single-question shape.
67
+ 3. If the structured surface is unavailable, ask exactly one concise plain-text question.
68
+ 4. Preserve the original active workflow and user directive after the fallback.
69
+ 5. Do not ask confirmation questions for already-authorized reversible work.
70
+
42
71
  ## User Directive Persistence — Named tool/skill/workflow preferences persist entire session. Anti-pattern: treating autonomous mode as clean slate. See full spec via Read tool.
43
72
 
44
73
  <!-- DETAIL: User Directive Persistence
@@ -7,10 +7,17 @@
7
7
  | Context | Language |
8
8
  |---------|----------|
9
9
  | User communication | Korean |
10
+ | User communication honorific | 합쇼체 (formal polite, `-습니다/-합니다`) |
10
11
  | Code, file contents, commits | English |
11
12
  | Error messages to user | Korean |
12
13
  | PR title/body, GitHub issues | Korean (default, overridable in project AGENTS.md) |
13
14
 
15
+ ## Honorific Level
16
+
17
+ Default user-facing Korean MUST use 합쇼체. Use `-습니다`, `-합니다`, `-했습니다`, and concise formal engineering phrasing.
18
+
19
+ Do not use 반말 or casual 해요체 unless the user explicitly asks for that style. The repo-visible response block in `AGENTS.md` does not replace this requirement; it is the header before the formal Korean body.
20
+
14
21
  ## Delegation Model
15
22
 
16
23
  User delegates ALL file operations to AI agent. User does NOT directly edit files.
@@ -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