Skip to content

Commit 06ac5e1

Browse files
feat(root): implement per-agent vendor dispatch and add new agents
Refine vendor detection logic across all supported CLIs. Add architecture-reviewer and tf-infra-engineer agents. Update documentation to reflect new dispatch strategy. Fix hook script existence checks and path configurations. Co-Authored-By: First Fluke <our.first.fluke@gmail.com>
1 parent 6477de2 commit 06ac5e1

51 files changed

Lines changed: 1292 additions & 98 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: architecture-reviewer
3+
description: Architecture review and recommendation. Use for system design, module boundaries, ADRs, and tradeoff analysis.
4+
skills:
5+
- oma-architecture
6+
---
7+
8+
You are an Architecture Specialist. Diagnose the architectural concern before recommending a solution. Use the lightest sufficient method for the decision at hand and compare at least two materially different options when the decision is significant.
9+
10+
## Execution Protocol
11+
12+
Follow the vendor-specific execution protocol:
13+
- Write results to project root `.agents/results/result-architecture.md` (orchestrated: `result-architecture-{sessionId}.md`)
14+
- Include: status, recommendation summary, tradeoffs, risks, validation steps, artifacts created
15+
16+
## Charter Preflight (MANDATORY)
17+
18+
Before ANY recommendations or structural edits, output this block:
19+
20+
```
21+
CHARTER_CHECK:
22+
- Clarification level: {LOW | MEDIUM | HIGH}
23+
- Task domain: architecture
24+
- Must NOT do: {3 constraints from task scope}
25+
- Success criteria: {measurable criteria}
26+
- Assumptions: {defaults applied}
27+
```
28+
29+
- LOW: proceed with assumptions
30+
- MEDIUM: list options, proceed with most likely
31+
- HIGH: set status blocked, list questions, DO NOT change architecture or code
32+
33+
## Rules
34+
35+
1. State the architecture problem explicitly before proposing options
36+
2. Distinguish architecture from UI design, PM planning, and Terraform delivery
37+
3. Compare implementation cost, operational cost, team complexity, and future change cost
38+
4. Surface assumptions, risks, and validation steps in every recommendation
39+
5. Save ADRs or architecture notes under `.agents/results/architecture/` when material
40+
6. Only modify code when the task explicitly requires implementation, not just review
41+
7. Never modify `.agents/` files
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: tf-infra-engineer
3+
description: Terraform infrastructure implementation and review. Use for cloud provisioning, IAM/OIDC, networking, and terraform plan review.
4+
skills:
5+
- oma-tf-infra
6+
---
7+
8+
You are a Terraform Infrastructure Specialist. Detect the provider and existing IaC layout before writing HCL. Prefer reusable modules, least-privilege IAM, and remote state with locking.
9+
10+
## Execution Protocol
11+
12+
Follow the vendor-specific execution protocol:
13+
- Write results to project root `.agents/results/result-tf-infra.md` (orchestrated: `result-tf-infra-{sessionId}.md`)
14+
- Include: status, summary, files changed, validation results, plan/apply notes, acceptance checklist
15+
16+
## Charter Preflight (MANDATORY)
17+
18+
Before ANY infrastructure changes, output this block:
19+
20+
```
21+
CHARTER_CHECK:
22+
- Clarification level: {LOW | MEDIUM | HIGH}
23+
- Task domain: tf-infra
24+
- Must NOT do: {3 constraints from task scope}
25+
- Success criteria: {measurable criteria}
26+
- Assumptions: {defaults applied}
27+
```
28+
29+
- LOW: proceed with assumptions
30+
- MEDIUM: list options, proceed with most likely
31+
- HIGH: set status blocked, list questions, DO NOT apply destructive changes
32+
33+
## Rules
34+
35+
1. Detect provider and existing module layout before writing new Terraform
36+
2. Run `terraform fmt`, `terraform validate`, and `terraform plan` before reporting complete when Terraform is present
37+
3. Use remote state, version pinning, and least-privilege IAM by default
38+
4. Prefer OIDC/workload identity over long-lived static credentials
39+
5. Do not hardcode secrets in `.tf` files or examples
40+
6. Document cost, drift, rollback, and continuity considerations for production changes
41+
7. Never run destructive operations without explicit user approval
42+
8. Never modify `.agents/` files

.agents/agents/variants/agent-variant.schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"title": "Agent Variant Configuration",
4-
"description": "Configuration for vendor-specific agent generation from core prompts",
4+
"description": "Configuration for vendor-specific agent generation from core agent prompts",
55
"type": "object",
66
"required": ["vendor", "destDir", "modelDefault", "toolsDefault", "protocolPath", "agents"],
77
"properties": {
@@ -10,7 +10,7 @@
1010
},
1111
"vendor": {
1212
"type": "string",
13-
"description": "The target CLI vendor name (e.g., gemini, claude)"
13+
"description": "The target CLI vendor name (e.g., claude, codex, gemini)"
1414
},
1515
"destDir": {
1616
"type": "string",
@@ -42,7 +42,7 @@
4242
},
4343
"agents": {
4444
"type": "object",
45-
"description": "Map of agent-id to vendor-specific overrides",
45+
"description": "Map of agent-id to vendor-specific overrides for generated Markdown or TOML agent files",
4646
"additionalProperties": {
4747
"type": "object",
4848
"properties": {

.agents/agents/variants/claude.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
"debug-investigator": {
1616
"maxTurns": 15
1717
},
18+
"architecture-reviewer": {
19+
"tools": "Read, Write, Edit, Bash, Grep, Glob",
20+
"maxTurns": 15
21+
},
22+
"tf-infra-engineer": {
23+
"tools": "Read, Write, Edit, Bash, Grep, Glob",
24+
"maxTurns": 20
25+
},
1826
"mobile-engineer": {},
1927
"pm-planner": {
2028
"tools": "Read, Write, Grep, Glob, Bash",

.agents/agents/variants/codex.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"$schema": "./agent-variant.schema.json",
3+
"vendor": "codex",
4+
"destDir": ".codex/agents",
5+
"modelDefault": "gpt-5.4",
6+
"toolsDefault": [],
7+
"protocolPath": ".agents/skills/_shared/runtime/execution-protocols/codex.md",
8+
"agents": {
9+
"backend-engineer": {
10+
"extra": {
11+
"sandbox_mode": "workspace-write"
12+
}
13+
},
14+
"frontend-engineer": {
15+
"extra": {
16+
"sandbox_mode": "workspace-write"
17+
}
18+
},
19+
"db-engineer": {
20+
"effort": "medium",
21+
"extra": {
22+
"sandbox_mode": "workspace-write"
23+
}
24+
},
25+
"debug-investigator": {
26+
"effort": "high",
27+
"extra": {
28+
"sandbox_mode": "workspace-write"
29+
}
30+
},
31+
"architecture-reviewer": {
32+
"effort": "high",
33+
"extra": {
34+
"sandbox_mode": "read-only"
35+
}
36+
},
37+
"tf-infra-engineer": {
38+
"effort": "medium",
39+
"extra": {
40+
"sandbox_mode": "workspace-write"
41+
}
42+
},
43+
"mobile-engineer": {
44+
"extra": {
45+
"sandbox_mode": "workspace-write"
46+
}
47+
},
48+
"pm-planner": {
49+
"effort": "medium",
50+
"extra": {
51+
"sandbox_mode": "read-only"
52+
}
53+
},
54+
"qa-reviewer": {
55+
"effort": "high",
56+
"extra": {
57+
"sandbox_mode": "read-only"
58+
}
59+
}
60+
}
61+
}

.agents/agents/variants/cursor.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
"readonly": true
2222
}
2323
},
24+
"architecture-reviewer": {
25+
"extra": {
26+
"readonly": true
27+
}
28+
},
2429
"debug-investigator": {},
2530
"mobile-engineer": {
2631
"extra": {
@@ -37,6 +42,11 @@
3742
"readonly": true,
3843
"is_background": true
3944
}
45+
},
46+
"tf-infra-engineer": {
47+
"extra": {
48+
"is_background": true
49+
}
4050
}
4151
}
4252
}

.agents/agents/variants/gemini.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"frontend-engineer": {},
1919
"db-engineer": {},
2020
"debug-investigator": {},
21+
"architecture-reviewer": {},
22+
"tf-infra-engineer": {},
2123
"mobile-engineer": {},
2224
"pm-planner": {
2325
"tools": [

.agents/hooks/core/persistent-mode.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,18 @@ async function main() {
203203
` 2. Or ask the user to say "워크플로우 완료" / "workflow done"`,
204204
].join("\n");
205205

206-
process.stdout.write(makeBlockOutput(vendor, reason));
207-
process.exit(2);
206+
writeBlockAndExit(vendor, reason);
208207
}
209208

210209
process.exit(0);
211210
}
212211

212+
export function writeBlockAndExit(vendor: Vendor, reason: string): never {
213+
process.stderr.write(reason);
214+
process.stdout.write(makeBlockOutput(vendor, reason));
215+
process.exit(2);
216+
}
217+
213218
if (import.meta.main) {
214219
main().catch(() => process.exit(0));
215220
}

.agents/hooks/core/test-filter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Works with: Claude Code, Codex CLI, Gemini CLI, Qwen Code
33

44
import { resolveGitRoot, makePreToolOutput, type Vendor } from "./types.ts";
5+
import { existsSync } from "node:fs";
56
import { join } from "node:path";
67

78
// --- Vendor detection (same logic as keyword-detector.ts) ---
@@ -130,6 +131,9 @@ const vendor = detectVendor(input);
130131
const projectDir = getProjectDir(vendor, input);
131132
const filterScript = join(projectDir, getHookDir(vendor), "filter-test-output.sh");
132133

134+
// Skip filtering if the script doesn't exist (hooks not fully installed)
135+
if (!existsSync(filterScript)) process.exit(0);
136+
133137
// Rewrite command to pipe through filter
134138
const filteredCmd = `set -o pipefail; (${command}) 2>&1 | bash "${filterScript}"`;
135139

.agents/skills/_shared/core/vendor-detection.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Vendor Detection Protocol
22

3-
When executing a workflow, determine your runtime environment using this priority order:
3+
When executing a workflow, determine your runtime environment using this priority order.
4+
Then resolve the target vendor for each agent from `.agents/oma-config.yaml` (`agent_cli_mapping`, `default_cli`).
5+
6+
Important:
7+
- Do **not** choose one spawn strategy for the entire workflow based only on the main runtime vendor.
8+
- Decide per agent:
9+
- `current_runtime_vendor`
10+
- `target_vendor_for_agent`
11+
- whether that exact runtime can invoke that target vendor natively
12+
- If native invocation is not available for that agent, fall back to `oma agent:spawn`.
413

514
## Detection Order (use first match)
615

@@ -15,7 +24,23 @@ When executing a workflow, determine your runtime environment using this priorit
1524
| Vendor | Spawn Method | Result Handling |
1625
|:---|:---|:---|
1726
| Claude Code | `Agent` tool with `.claude/agents/{name}.md` | Synchronous return |
18-
| Codex CLI | Model-mediated parallel subagent request | JSON output |
19-
| Gemini CLI | `@{agent-name}` delegation or `oma agent:spawn` | MCP memory poll |
20-
| Antigravity | `oma agent:spawn` only (custom subagents not available) | MCP memory poll |
27+
| Codex CLI | Native custom agents in `.codex/agents/{name}.toml` via `codex exec "@agent ..."` when available, otherwise `oma agent:spawn` | JSON output |
28+
| Gemini CLI | `.gemini/agents/{name}.md` native subagents via `gemini -p "@agent ..."` when available, otherwise `oma agent:spawn` | JSON output or MCP memory poll |
29+
| Antigravity | Prefer `oma agent:spawn` unless a native role-subagent path is explicitly verified for the target vendor | MCP memory poll |
2130
| CLI Fallback | `oma agent:spawn {agent} {prompt} {session} -w {workspace}` | Result file poll |
31+
32+
## Dispatch Rule
33+
34+
For each agent:
35+
36+
1. Resolve `target_vendor_for_agent` from config
37+
2. If `target_vendor_for_agent === current_runtime_vendor` and that runtime has a verified native role-subagent path for that vendor, use the vendor variant agent definition
38+
3. Otherwise, use `oma agent:spawn`
39+
40+
Example:
41+
- Runtime: Claude Code
42+
- Mapping: `frontend: claude`, `backend: claude`, `qa: gemini`
43+
- Result:
44+
- `frontend` -> native Claude subagent
45+
- `backend` -> native Claude subagent
46+
- `qa` -> external Gemini spawn

0 commit comments

Comments
 (0)