feat(config): add execution context profiles for mode-specific agent output (#1827)

* feat(config): add execution context profiles for mode-specific agent output

* fix(config): add enum validation for context config key

Validate context values against allowed enum (dev, research, review)
in cmdConfigSet before writing to config.json, matching the pattern
used for model_profile validation. Add rejection test for invalid
context values.
This commit is contained in:
Rezolv
2026-04-05 19:09:19 -04:00
committed by GitHub
parent f25ae33dff
commit e107b4e225
6 changed files with 138 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ const VALID_CONFIG_KEYS = new Set([
'workflow.subagent_timeout',
'hooks.context_warnings',
'features.thinking_partner',
'context',
'project_code', 'phase_naming',
'manager.flags.discuss', 'manager.flags.plan', 'manager.flags.execute',
'response_language',
@@ -337,6 +338,11 @@ function cmdConfigSet(cwd, keyPath, value, raw) {
try { parsedValue = JSON.parse(value); } catch { /* keep as string */ }
}
const VALID_CONTEXT_VALUES = ['dev', 'research', 'review'];
if (keyPath === 'context' && !VALID_CONTEXT_VALUES.includes(String(parsedValue))) {
error(`Invalid context value '${value}'. Valid values: ${VALID_CONTEXT_VALUES.join(', ')}`);
}
const setConfigValueResult = setConfigValue(cwd, keyPath, parsedValue);
output(setConfigValueResult, raw, `${keyPath}=${parsedValue}`);
}

View File

@@ -0,0 +1,21 @@
# Dev Context Profile
Agent output guidance for dev mode. Loaded when `context: dev` is set in config.json.
## Output Style
- Concise, action-oriented responses
- Lead with the code change or command, follow with brief rationale
- Skip preamble — assume the developer has full context
- Use inline code references (`file:line`) over prose descriptions
## Focus Areas
- Working code that compiles and passes tests
- Minimal diff — change only what is necessary
- Flag side effects or breaking changes immediately
- Surface the next actionable step at the end of every response
## Verbosity
Low. One-liner explanations unless the change is non-obvious. Omit background theory, alternative approaches, and caveats that do not affect the current task.

View File

@@ -0,0 +1,22 @@
# Research Context Profile
Agent output guidance for research mode. Loaded when `context: research` is set in config.json.
## Output Style
- Verbose, exploratory responses that surface trade-offs and alternatives
- Present multiple approaches with pros and cons before recommending one
- Include links, references, and citations where available
- Use structured headings and bullet lists for scan-ability
## Focus Areas
- Breadth of options — enumerate before narrowing
- Prior art and ecosystem conventions
- Risks, edge cases, and failure modes
- Dependencies and compatibility implications
- Long-term maintainability of each approach
## Verbosity
High. Explain reasoning, show evidence, and document assumptions. Include background context even if the developer likely knows it — research artifacts are read by future contributors who may not.

View File

@@ -0,0 +1,22 @@
# Review Context Profile
Agent output guidance for review mode. Loaded when `context: review` is set in config.json.
## Output Style
- Critical, detail-focused responses that prioritize correctness
- Organize findings by severity: blocking, important, nit
- Reference specific lines and files for every finding
- State what is correct as well as what needs change — confirm the good parts
## Focus Areas
- Correctness — logic errors, off-by-ones, missing edge cases
- Security — input validation, injection vectors, secret exposure
- Performance — unnecessary allocations, O(n^2) patterns, missing caching
- Style and consistency — naming, formatting, import order
- Test coverage — untested branches, missing assertions, flaky patterns
## Verbosity
Medium. Be thorough on findings but terse in explanation. Each issue should be one to three sentences: what is wrong, why it matters, and how to fix it.