Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/agents/refactor-engineer.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Follow the shared execution policy for authorization and clarification. State ma
1. **Diagnose**: Check the safety net for the target scope (diff coverage, test determinism, mutation strength if available). No net -> build it first.
2. **Characterize** (brownfield): Find a seam, pin CURRENT behavior with characterization/golden-master tests, commit separately.
3. **Target**: Rank by hotspot (complexity x churn), not smell aesthetics. Skip cold complex code.
4. **Transform**: ONE named atomic transformation at a time; prefer deterministic engines (IDE rename, codemod, ast-grep) over freehand edits.
4. **Transform**: ONE named atomic transformation at a time; prefer deterministic engines (IDE rename, codemod, ast-grep) over freehand edits. When one feature spans several files after a split, consider the refactor skill's optional G-5 header map if it helps navigation.
5. **Verify**: Re-run existing tests UNCHANGED. Pass -> commit `refactor:` only. Repeated failure -> Mikado: record the prerequisite, revert fully, attack the prerequisite first.
6. **Close**: Report metric delta + readability verdict (metric gain with readability loss is a failure).

Expand Down
32 changes: 6 additions & 26 deletions .agents/agents/variants/claude.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,24 @@
"vendor": "claude",
"destDir": ".claude/agents",
"modelDefault": "sonnet",
"maxTurnsDefault": 30,
"maxTurnsDefault": 100,
"toolsDefault": "Read, Write, Edit, Bash, Grep, Glob",
"protocolPath": ".agents/skills/_shared/runtime/execution-protocols/claude.md",
"agents": {
"backend-engineer": {
"maxTurns": 40
},
"frontend-engineer": {
"maxTurns": 40
},
"db-engineer": {
"maxTurns": 25
},
"debug-investigator": {
"maxTurns": 25
},
"architecture-reviewer": {
"tools": "Read, Write, Edit, Bash, Grep, Glob",
"maxTurns": 15
"tools": "Read, Write, Edit, Bash, Grep, Glob"
},
"tf-infra-engineer": {
"tools": "Read, Write, Edit, Bash, Grep, Glob",
"maxTurns": 30
},
"mobile-engineer": {
"maxTurns": 40
"tools": "Read, Write, Edit, Bash, Grep, Glob"
},
"pm-planner": {
"tools": "Read, Write, Grep, Glob, Bash",
"maxTurns": 10
"tools": "Read, Write, Grep, Glob, Bash"
},
"qa-reviewer": {
"tools": "Read, Grep, Glob, Bash",
"maxTurns": 15
"tools": "Read, Grep, Glob, Bash"
},
"docs-curator": {
"tools": "Read, Write, Edit, Bash, Grep, Glob",
"maxTurns": 15
"tools": "Read, Write, Edit, Bash, Grep, Glob"
},
"research-explorer": {
"tools": "Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch"
Expand Down
32 changes: 6 additions & 26 deletions .agents/agents/variants/commandcode.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,24 @@
"vendor": "commandcode",
"destDir": ".commandcode/agents",
"modelDefault": "inherit",
"maxTurnsDefault": 30,
"maxTurnsDefault": 100,
"toolsDefault": "Read, Write, Edit, Bash, Grep, Glob",
"protocolPath": ".agents/skills/_shared/runtime/execution-protocols/commandcode.md",
"agents": {
"backend-engineer": {
"maxTurns": 40
},
"frontend-engineer": {
"maxTurns": 40
},
"db-engineer": {
"maxTurns": 25
},
"debug-investigator": {
"maxTurns": 25
},
"architecture-reviewer": {
"tools": "Read, Write, Edit, Bash, Grep, Glob",
"maxTurns": 15
"tools": "Read, Write, Edit, Bash, Grep, Glob"
},
"tf-infra-engineer": {
"tools": "Read, Write, Edit, Bash, Grep, Glob",
"maxTurns": 30
},
"mobile-engineer": {
"maxTurns": 40
"tools": "Read, Write, Edit, Bash, Grep, Glob"
},
"pm-planner": {
"tools": "Read, Write, Grep, Glob, Bash",
"maxTurns": 10
"tools": "Read, Write, Grep, Glob, Bash"
},
"qa-reviewer": {
"tools": "Read, Grep, Glob, Bash",
"maxTurns": 15
"tools": "Read, Grep, Glob, Bash"
},
"docs-curator": {
"tools": "Read, Write, Edit, Bash, Grep, Glob",
"maxTurns": 15
"tools": "Read, Write, Edit, Bash, Grep, Glob"
}
}
}
35 changes: 2 additions & 33 deletions .agents/agents/variants/grok.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,8 @@
"vendor": "grok",
"destDir": ".grok/agents",
"modelDefault": "grok-build",
"maxTurnsDefault": 30,
"maxTurnsDefault": 100,
"toolsDefault": "run_terminal_cmd, read_file, search_replace, list_dir, grep",
"protocolPath": ".agents/skills/_shared/runtime/execution-protocols/grok.md",
"agents": {
"backend-engineer": {
"maxTurns": 40
},
"frontend-engineer": {
"maxTurns": 40
},
"db-engineer": {
"maxTurns": 25
},
"debug-investigator": {
"maxTurns": 25
},
"architecture-reviewer": {
"maxTurns": 15
},
"tf-infra-engineer": {
"maxTurns": 30
},
"mobile-engineer": {
"maxTurns": 40
},
"pm-planner": {
"maxTurns": 10
},
"qa-reviewer": {
"maxTurns": 15
},
"docs-curator": {
"maxTurns": 15
}
}
"agents": {}
}
32 changes: 4 additions & 28 deletions .agents/agents/variants/kiro.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"vendor": "kiro",
"destDir": ".kiro/agents",
"modelDefault": "inherit",
"maxTurnsDefault": 30,
"maxTurnsDefault": 100,
"toolsDefault": [
"read",
"write",
Expand All @@ -15,38 +15,14 @@
],
"protocolPath": ".agents/skills/_shared/runtime/execution-protocols/kiro.md",
"agents": {
"backend-engineer": {
"maxTurns": 40
},
"frontend-engineer": {
"maxTurns": 40
},
"db-engineer": {
"maxTurns": 25
},
"debug-investigator": {
"maxTurns": 25
},
"architecture-reviewer": {
"tools": ["read", "grep", "glob", "code"],
"maxTurns": 15
},
"tf-infra-engineer": {
"maxTurns": 30
},
"mobile-engineer": {
"maxTurns": 40
"tools": ["read", "grep", "glob", "code"]
},
"pm-planner": {
"tools": ["read", "grep", "glob", "shell"],
"maxTurns": 10
"tools": ["read", "grep", "glob", "shell"]
},
"qa-reviewer": {
"tools": ["read", "grep", "glob", "shell"],
"maxTurns": 15
},
"docs-curator": {
"maxTurns": 15
"tools": ["read", "grep", "glob", "shell"]
}
}
}
3 changes: 3 additions & 0 deletions .agents/hooks/core/agentmemory-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ export async function observeWithTimeout(payload: {
try {
const adapter = currentMemoryAdapter(payload.projectDir);
if (adapter) return await adapter.observe(payload);
// An explicit opt-out leaves no observation to retry. Injected adapters
// still own their delivery policy, including non-AgentMemory providers.
if (process.env.OMA_NO_AGENTMEMORY === "1") return true;
if (!(await isAgentMemoryReachable())) return false;
const url = endpointUrl();
if (!url) return false;
Expand Down
42 changes: 26 additions & 16 deletions .agents/hooks/core/code-intelligence-guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
// a name predicate pass through — they are not discovery.
// - Gating: only fires when `providers.code_intelligence` resolves (yaml or
// `.serena/project.yml`) and `providers.code_intelligence_guard` is not
// `off`. The hook cannot observe whether the MCP server is actually up, so
// the deny reason names the escape hatch.
// - Escape hatch: a shell command containing `OMA_CI_ALLOW_NATIVE=1` bypasses
// the guard (mirrors scm-guard's `OMA_SCM_ALLOW_SECRETS=1`). Grep/Glob have
// no argument to carry a token, so the fallback for those is the shell path.
// `off`. The hook cannot observe whether the MCP server is actually up.
// The deny reason does not name a bypass: confirmed exclusions and
// external paths already pass, and project source stays on the provider.
// - Escape hatch: a shell command containing `OMA_CI_ALLOW_NATIVE=1` still
// bypasses the guard. That prefix is only for a search of resources
// outside the project or ignored paths the guard did not recognize, never
// for project source. Do not advertise it in the deny reason. Grep/Glob
// have no argument to carry a token, so the hatch stays shell-only.

import { readFileSync } from "node:fs";
import { isAbsolute, resolve } from "node:path";
Expand Down Expand Up @@ -342,9 +345,10 @@ function denyReason(
`[oma code-intelligence-guard] Blocked ${detail}: ${label} is the configured code-intelligence provider ` +
`(providers.code_intelligence in .agents/oma-config.yaml). Use ${replacementFor(provider, kind)} instead; ` +
`load the deferred ${label} tools first if needed. ` +
`Searches scoped entirely to confirmed provider exclusions or external paths are allowed. ` +
`If ${label} is unavailable, timed out, or cannot search the requested path (including unrecognized exclusions), run the search through the shell tool ` +
`with the command prefixed by ${BYPASS_TOKEN}. ` +
`Native search is only for paths outside this project or ignored paths. ` +
`Searches scoped entirely to confirmed provider exclusions or external paths are already allowed; ` +
`narrow the path if this search was meant to be one of those. ` +
`Do not bypass this guard to search project source. ` +
`Set providers.code_intelligence_guard: off to disable this guard.`
);
}
Expand All @@ -358,11 +362,15 @@ function denyReason(
*/
export async function run(
input: HookInput,
_ctx: HandlerCtx,
ctx: HandlerCtx,
): Promise<HandlerResult | null> {
if (input.kind !== "pre_tool") return null;

const { toolName, toolInput, cwd: projectDir } = input;
const { toolName, toolInput } = input;
// Config and the project-scope check use the resolved project root; the
// tool's relative paths are relative to the session's working directory.
const projectDir = ctx.cwd || input.cwd;
const sessionCwd = input.cwd || projectDir;

const isGrep = GREP_TOOLS.has(toolName);
const isGlob = GLOB_TOOLS.has(toolName);
Expand All @@ -380,23 +388,25 @@ export async function run(

// Config reads happen after the cheap tool/command checks so the common
// (non-search) path never touches the filesystem.
const provider = detectCodeIntelligenceProvider(projectDir);
const provider = detectCodeIntelligenceProvider(projectDir, ctx.config);
if (!provider) return null;
if (detectCodeIntelligenceGuardMode(projectDir) === "off") return null;
if (detectCodeIntelligenceGuardMode(projectDir, ctx.config) === "off") {
return null;
}

let roots: string[] | null = null;
if (isShell) {
roots = shellSearchRoots(toolInput.command as string, projectDir);
roots = shellSearchRoots(toolInput.command as string, sessionCwd);
} else if (isGlob && typeof toolInput.pattern === "string") {
const base =
typeof toolInput.path === "string" ? toolInput.path : projectDir;
typeof toolInput.path === "string" ? toolInput.path : sessionCwd;
const target = isAbsolute(toolInput.pattern)
? toolInput.pattern
: `${resolve(projectDir, base)}/${toolInput.pattern}`;
: `${resolve(sessionCwd, base)}/${toolInput.pattern}`;
const root = searchPathRoot(target);
if (root) roots = [root];
} else if (typeof toolInput.path === "string") {
roots = [toolInput.path];
roots = [resolve(sessionCwd, toolInput.path)];
}
if (roots && isExcludedSearchScope(provider, projectDir, roots)) return null;

Expand Down
Loading
Loading