refactor(cli): change from env var injection to direct prompt concatenation

- Replace $PROTO/$TMPL environment variable injection with systemRules/roles direct concatenation
- Append rules to END of prompt instead of prepending
- Change prompt field name from RULES to CONSTRAINTS in all prompts
- Default to universal-rigorous-style template when --rule not specified
- Update all .claude documentation, agents, commands, and skills
- Add streaming_content type support for Gemini delta messages

Breaking: Prompts now use CONSTRAINTS field instead of RULES
This commit is contained in:
catlog22
2026-01-17 21:30:05 +08:00
parent 1e691fa751
commit 5b5dc85677
21 changed files with 136 additions and 95 deletions

View File

@@ -215,7 +215,7 @@ CONTEXT: @**/* | Memory: {ace_context_summary}
EXPECTED: JSON with feasibility_score, findings, implementation_approaches, technical_concerns, code_locations
RULES: $PROTO |
CONSTRAINTS:
- Specific file:line references
- Quantify effort estimates
- Concrete pros/cons

View File

@@ -114,10 +114,10 @@ plan → planning/architecture-planning.txt | planning/task-breakdown.txt
bug-fix → development/bug-diagnosis.txt
```
**3. RULES Field**:
- Use `--rule <template>` option to auto-load protocol + template as `$PROTO` and `$TMPL`
**3. CONSTRAINTS Field**:
- Use `--rule <template>` option to auto-load protocol + template (appended to prompt)
- Template names: `category-function` format (e.g., `analysis-code-patterns`, `development-feature`)
- NEVER escape: `\$`, `\"`, `\'` breaks variable expansion
- NEVER escape: `\"`, `\'` breaks shell parsing
**4. Structured Prompt**:
```bash
@@ -126,7 +126,7 @@ TASK: {specific_task_with_details}
MODE: {analysis|write|auto}
CONTEXT: {structured_file_references}
EXPECTED: {clear_output_expectations}
RULES: $PROTO $TMPL | {constraints}
CONSTRAINTS: {constraints}
```
---
@@ -157,7 +157,7 @@ TASK: {task}
MODE: analysis
CONTEXT: @**/*
EXPECTED: {output}
RULES: $PROTO $TMPL
CONSTRAINTS: {constraints}
" --tool gemini --mode analysis --rule analysis-code-patterns --cd {dir}
# Qwen fallback: Replace '--tool gemini' with '--tool qwen'

View File

@@ -106,7 +106,7 @@ EXPECTED:
## Time Estimate
**Total**: [time]
RULES: $PROTO $TMPL |
CONSTRAINTS:
- Follow schema structure from {schema_path}
- Acceptance/verification must be quantified
- Dependencies use task IDs

View File

@@ -127,7 +127,7 @@ EXPECTED: Structured fix strategy with:
- Fix approach ensuring business logic correctness (not just test passage)
- Expected outcome and verification steps
- Impact assessment: Will this fix potentially mask other issues?
RULES: $PROTO $TMPL |
CONSTRAINTS:
- For {test_type} tests: {layer_specific_guidance}
- Avoid 'surgical fixes' that mask underlying issues
- Provide specific line numbers for modifications

View File

@@ -105,7 +105,7 @@ TASK: • Analyze error pattern • Identify potential root causes • Suggest t
MODE: analysis
CONTEXT: @{affected_files}
EXPECTED: Structured hypothesis list with priority ranking
RULES: $PROTO $TMPL | Focus on testable conditions
CONSTRAINTS: Focus on testable conditions
" --tool gemini --mode analysis --cd {project_root}
```
@@ -213,7 +213,7 @@ EXPECTED:
- Evidence summary
- Root cause identification (if confirmed)
- Next steps (if inconclusive)
RULES: $PROTO $TMPL | Evidence-based reasoning only
CONSTRAINTS: Evidence-based reasoning only
" --tool gemini --mode analysis
```
@@ -271,7 +271,7 @@ TASK:
MODE: write
CONTEXT: @{affected_files}
EXPECTED: Working fix that addresses root cause
RULES: $PROTO $TMPL | Minimal changes only
CONSTRAINTS: Minimal changes only
" --tool codex --mode write --cd {project_root}
```

View File

@@ -70,7 +70,7 @@ The agent supports **two execution modes** based on task JSON's `meta.cli_execut
CONTEXT: @**/* ./src/modules/auth|code|code:5|dirs:2
./src/modules/api|code|code:3|dirs:0
EXPECTED: Documentation files in .workflow/docs/my_project/src/modules/
RULES: $PROTO $TMPL | Mirror source structure
CONSTRAINTS: Mirror source structure
" --tool gemini --mode write --rule documentation-module --cd src/modules
```
@@ -216,7 +216,7 @@ Before completion, verify:
{
"step": "analyze_module_structure",
"action": "Deep analysis of module structure and API",
"command": "ccw cli -p \"PURPOSE: Document module comprehensively\nTASK: Extract module purpose, architecture, public API, dependencies\nMODE: analysis\nCONTEXT: @**/* System: [system_context]\nEXPECTED: Complete module analysis for documentation\nRULES: $PROTO $TMPL\" --tool gemini --mode analysis --rule documentation-module --cd src/auth",
"command": "ccw cli -p \"PURPOSE: Document module comprehensively\nTASK: Extract module purpose, architecture, public API, dependencies\nMODE: analysis\nCONTEXT: @**/* System: [system_context]\nEXPECTED: Complete module analysis for documentation\nCONSTRAINTS: Mirror source structure\" --tool gemini --mode analysis --rule documentation-module --cd src/auth",
"output_to": "module_analysis",
"on_error": "fail"
}

View File

@@ -87,7 +87,7 @@ TASK: • Detect file conflicts (same file modified by multiple solutions)
MODE: analysis
CONTEXT: @.workflow/issues/solutions/**/*.jsonl | Solution data: \${SOLUTIONS_JSON}
EXPECTED: JSON array of conflicts with type, severity, solutions, recommended_order
RULES: $PROTO | Severity: high (API/data) > medium (file/dependency) > low (architecture)
CONSTRAINTS: Severity: high (API/data) > medium (file/dependency) > low (architecture)
" --tool gemini --mode analysis --cd .workflow/issues
```