Date: 2026-06-08
Status: MVP Implemented (Phases 0-4 Complete)
Implementation Plan: /Users/chris/Downloads/agentic_agile_v_openhands_implementation_plan.md
Successfully implemented the MVP scope of the OpenHands integration for Agentic Agile-V, establishing OpenHands as an execution backend while preserving Agile-V as the control, evidence, and verification layer.
β
Phase 0: Integration contract and ADR documentation
β
Phase 1: OpenHands CLI namespace (agilev openhands ...)
β
Phase 2: Five skills for progressive disclosure
β
Phase 3: Seven lifecycle hooks with mechanical enforcement
β
Phase 4: Task context resolution from multiple sources
β³ Phases 5-12: Evidence schema extensions, evidence adapter, scope enforcement, builder/verifier pattern, GitHub Actions, event ledger, reports, and examples.
βββββββββββββββββββββββββββββββββββββββββββ
β Agentic Agile-V Control Plane β
β - Task briefs & risk classification β
β - Evidence requirements & validation β
β - Scope control & approval policy β
βββββββββββββββ¬ββββββββββββββββββββββββββββ
β skills + hooks
β
βββββββββββββββββββββββββββββββββββββββββββ
β OpenHands Execution Plane β
β - Repository inspection & analysis β
β - Code implementation β
β - Test execution β
β - Pull request creation β
βββββββββββββββ¬ββββββββββββββββββββββββββββ
β evidence
β
βββββββββββββββββββββββββββββββββββββββββββ
β Evidence Bundle + Verification β
β - Changed files & test results β
β - Tool usage logs β
β - Verifier reports (L2+) β
βββββββββββββββββββββββββββββββββββββββββββ
Created:
docs/adr/ADR-0001-openhands-execution-backend.mddocs/integrations/openhands.mdconfig/openhands.yaml
Key Decisions:
- OpenHands owns execution, Agile-V owns acceptance
- Skills teach, hooks enforce
- Evidence validation is independent of agent claims
- L3/L4 changes cannot be self-approved by agents
Files:
- Integration responsibilities documented
- Non-goals explicit (no self-approval, no bypassing briefs)
- Risk mitigation strategies defined
Created:
src/agilev/openhands/__init__.pysrc/agilev/openhands/scaffold.py(1400+ lines)- Extended
src/agilev/cli.pywithopenhandssubcommand group
Commands:
agilev openhands init # Generate integration files
agilev openhands doctor # Validate setup
agilev openhands scaffold # Regenerate files
agilev openhands validate # Validate session for task
agilev openhands handoff # Show handoff reportFeatures:
- Idempotent initialization (--force to overwrite)
- Comprehensive validation (21 checks across skills, hooks, policies, config)
- Force regeneration support
- Task-specific validation
Created Skills:
-
agile-v-core (
.agents/skills/agile-v-core/SKILL.md)- Core workflow rules
- Task brief requirement before implementation
- Evidence-controlled acceptance
- Risk-level guidance (L0-L4)
- Never: remove tests, weaken security, self-approve L3/L4
-
agile-v-builder (
.agents/skills/agile-v-builder/SKILL.md)- Implementation workflow (inspect β plan β edit β test β document)
- Scope minimization
- Test-first mindset
- Evidence collection guidance
- Implementation summary requirements
-
agile-v-verifier (
.agents/skills/agile-v-verifier/SKILL.md)- Independent verification from fresh context
- Acceptance criteria mapping
- Edge case detection
- Scope creep detection
- Verification report requirements
- Cannot self-approve L3/L4
-
agile-v-evidence (
.agents/skills/agile-v-evidence/SKILL.md)- Evidence bundle maintenance
- Never fabricate evidence
- Git/CI as source of truth
- OpenHands metadata extensions
-
agile-v-risk-classifier (
.agents/skills/agile-v-risk-classifier/SKILL.md)- L0-L4 classification guidance
- Evidence requirements by level
- Examples for each level
- Escalation rules (when uncertain, escalate)
Design:
- Concise enough to load efficiently
- Reference Agile-V artifacts (don't duplicate methodology)
- Progressive disclosure (load based on mode: builder/verifier)
Created Hooks:
| Hook | Lifecycle | Blocking | Purpose |
|---|---|---|---|
enforce_task_brief.sh |
user_prompt_submit |
Yes | Require task ID/brief before implementation |
block_unsafe_commands.sh |
pre_tool_use (terminal) |
Yes | Block destructive commands |
validate_scope.sh |
pre_tool_use (all) |
Yes | Check scope (MVP: allow + warn) |
log_tool_usage.sh |
post_tool_use |
No | Append to tool log (JSONL) |
collect_session_metadata.sh |
session_start |
No | Record session metadata |
validate_evidence_on_stop.sh |
stop |
Yes | Block until evidence passes |
generate_handoff_on_session_end.sh |
session_end |
No | Generate handoff summary |
Hook Configuration:
.openhands/hooks.json- Hook registry with matchers and timeouts- Hooks return JSON:
{"decision": "allow|deny", "reason": "..."} - Blocking hooks exit with code 2 on deny
- All hooks are executable (chmod +x)
Dangerous Command Patterns Blocked:
rm -rf /dd if=mkfs- Fork bombs
chmod 777curl ... | sudo bash- And more...
Setup Script:
.openhands/setup.sh- Validates environment, makes hooks executable, checks for agilev CLI
Created:
src/agilev/task_context.py- TaskContextResolver class
Resolution Order:
- Explicit CLI option (
--task AAV-001) - Environment variable (
AGILEV_TASK_ID=AAV-001) - Git branch name (
aav-001-*pattern) - GitHub metadata (
GITHUB_PR_TITLE,GITHUB_ISSUE_TITLE) - Latest modified task (if unambiguous within 24 hours)
- Fail with clear error if ambiguous
Features:
- Task ID normalization (AAV-001 β AAV-0001)
- Fail-closed on ambiguity (prevents writing to wrong task)
- Branch pattern matching (case-insensitive)
- Validation of task existence
Policy Configuration:
config/policies/openhands_dangerous_commands.yaml- Blocked command patternsconfig/policies/scope_policy.yaml- Default scope behavior, security-sensitive pathsconfig/policies/approval_policy.yaml- Human approval requirements by risk levelconfig/policies/evidence_policy.yaml- Evidence requirements by risk levelconfig/policies/risk_level_policy.yaml- Risk classification guidance and auto-classification
Highlights:
- L0: Documentation (no approval)
- L1: Tests or rationale (no approval)
- L2: Passing tests + verifier (reviewer approval)
- L3: L2 + rollback path (domain owner approval)
- L4: L3 + simulation/HIL/formal + traceability (formal approval)
agentic_agile_v/
βββ docs/
β βββ adr/
β β βββ ADR-0001-openhands-execution-backend.md
β βββ integrations/
β βββ openhands.md
βββ config/
β βββ openhands.yaml
β βββ policies/
β βββ openhands_dangerous_commands.yaml
β βββ scope_policy.yaml
β βββ approval_policy.yaml
β βββ evidence_policy.yaml
β βββ risk_level_policy.yaml
βββ .agents/
β βββ skills/
β βββ agile-v-core/SKILL.md
β βββ agile-v-builder/SKILL.md
β βββ agile-v-verifier/SKILL.md
β βββ agile-v-evidence/SKILL.md
β βββ agile-v-risk-classifier/SKILL.md
βββ .openhands/
β βββ setup.sh
β βββ hooks.json
β βββ hooks/
β β βββ enforce_task_brief.sh
β β βββ block_unsafe_commands.sh
β β βββ validate_scope.sh
β β βββ log_tool_usage.sh
β β βββ collect_session_metadata.sh
β β βββ validate_evidence_on_stop.sh
β β βββ generate_handoff_on_session_end.sh
β βββ logs/
βββ src/agilev/
βββ cli.py (extended with openhands commands)
βββ task_context.py
βββ openhands/
β βββ __init__.py
β βββ scaffold.py
βββ policies/
β βββ __init__.py
βββ ledger/
βββ __init__.py
Test Script: test_openhands_integration.py
β
OpenHandsScaffold - All components created
β
Doctor checks - 21/21 passed after init
β
TaskContextResolver - Explicit and normalized task IDs
β
Skills - All 5 skills created with proper YAML frontmatter
β
Hooks - All 7 hooks created and executable
β
Policies - All 5 policy files created
# Check skills exist
$ ls .agents/skills/
agile-v-builder agile-v-core agile-v-evidence
agile-v-risk-classifier agile-v-verifier
# Check hooks are executable
$ ls -la .openhands/hooks/*.sh
-rwxr-xr-x block_unsafe_commands.sh
-rwxr-xr-x collect_session_metadata.sh
-rwxr-xr-x enforce_task_brief.sh
-rwxr-xr-x generate_handoff_on_session_end.sh
-rwxr-xr-x log_tool_usage.sh
-rwxr-xr-x validate_evidence_on_stop.sh
-rwxr-xr-x validate_scope.sh
# Check doctor validation
$ python3 -c "..."
Total checks: 21
Passed: 21
Failed: 0cd your-agentic-agile-v-repo
agilev openhands initOutput:
π§ Initializing OpenHands integration...
β
OpenHands integration initialized
Created 19 files:
π Skills:
β .agents/skills/agile-v-core/SKILL.md
β .agents/skills/agile-v-builder/SKILL.md
β .agents/skills/agile-v-verifier/SKILL.md
β .agents/skills/agile-v-evidence/SKILL.md
β .agents/skills/agile-v-risk-classifier/SKILL.md
πͺ Hooks:
β .openhands/hooks/enforce_task_brief.sh
β .openhands/hooks/block_unsafe_commands.sh
β .openhands/hooks/validate_scope.sh
...
π Policies:
β config/policies/openhands_dangerous_commands.yaml
...
agilev openhands doctorOutput:
π Checking OpenHands integration setup...
Core Files:
β
agents_md
β
setup_script
β
hooks_config
β
openhands_config
Skills:
β
skill_agile-v-core
β
skill_agile-v-builder
...
Results: 21 passed, 0 failed
β
OpenHands integration ready
agilev new --title "Add retry handling" --risk L2Currently: Launch OpenHands manually and point to the repository. Skills and hooks activate automatically.
Future: agilev openhands run --task AAV-0001 --mode builder
agilev openhands validate --task AAV-0001agilev openhands handoff --task AAV-0001- Add
agent_executionsection (engine, mode, session_id, tool_log_path) - Add
scope_controlsection (allowed_paths, blocked_paths, violations) - Add
verificationsection (builder_summary, verifier_report, result) - Maintain backward compatibility with existing evidence bundles
agilev openhands evidence collect --task AAV-XXXX- Map OpenHands tool log β evidence bundle
- Map Git diff β changed_files (truth over agent claims)
- Map test outputs β tests.results
- Map CI results β checks
- Never fabricate passed tests
- Parse task brief YAML frontmatter for allowed/blocked paths
- Compare changed files (from Git) against allowed paths
- Block or warn on out-of-scope changes
- Detect dependency changes (Python, Node, Rust, Go, Java)
- Flag public API changes
- Full implementation of
validate_scope.shhook
agilev openhands run --task AAV-XXXX --mode builderagilev openhands verify --task AAV-XXXX --fresh-context- Separate builder and verifier sessions
- Verifier read-only by default
- Verifier report schema and validation
- L2+ requires verifier
.github/workflows/agilev-openhands-builder.yml.github/workflows/agilev-openhands-verifier.yml.github/workflows/agilev-gates.yml- Label-driven automation
- PR comment with evidence summary
- Merge blocking on failed gates
- Append-only event log (
events.jsonl) - Hash chain for tamper detection
- Event types: TaskBriefCreated, ToolUsed, EvidenceUpdated, etc.
- Ledger validation command
agilev report --task AAV-XXXX- Deterministic from files/evidence (not agent memory)
- Suitable for PR comments and human review
- Handoff includes: objective, changed files, tests, risks, next action
- Quickstart guide
- Integration patterns (builder + verifier)
- Example task packages (L0-L4)
- Troubleshooting guide
- Video walkthrough
| Component | Files Created | Lines of Code |
|---|---|---|
| Documentation | 2 | ~1,500 |
| Configuration | 6 | ~500 |
| Python Modules | 4 | ~1,600 |
| Skills | 5 | ~400 |
| Hooks | 8 | ~200 |
| Total | 25 | ~4,200 |
- β OpenHandsScaffold initialization
- β Doctor validation (21 checks)
- β Task context resolution
- β File creation and permissions
- β³ Hook execution (not yet tested)
- β³ Evidence adapter (not yet implemented)
- β³ Scope validation (not yet implemented)
| Risk | Mitigation | Status |
|---|---|---|
| Agent bypasses task brief | enforce_task_brief.sh hook blocks |
β Implemented |
| Agent removes tests | Skill forbids; evidence tracks delta | β Skill documented |
| Agent expands scope | validate_scope.sh hook (MVP: warn) |
β³ Partial (warns only) |
| Agent self-approves L3/L4 | Policy enforces human approval; CI blocks | β Policy defined |
| Agent fabricates evidence | Evidence adapter uses Git/CI truth | β³ Not yet implemented |
| Hook or skill ignored | Stop hook blocks; CI fails | β Stop hook implemented |
- Skill-based progressive disclosure: Skills are concise, loadable, and extensible
- Hook-based enforcement: Mechanical gates that don't rely on agent compliance
- Policy-driven design: YAML policies are human-readable and version-controllable
- Task context resolution: Flexible resolution order reduces friction
- Idempotent scaffolding: Safe to re-run, respects existing files
- Python environment issues: Testing required PYTHONPATH workarounds
- Scope validation complexity: Full implementation deferred to Phase 7
- Evidence schema extension: Backward compatibility requires careful design
- GitHub Actions integration: Requires OpenHands SDK or wrapper scripts
- MVP scope validation: Allow + warn vs. strict blocking (chose allow for MVP)
- Hook language: Bash vs. Python (chose Bash for simplicity and no dependencies)
- Evidence source: Agent claims vs. Git/CI (chose Git/CI as source of truth)
- Skill size: Comprehensive vs. concise (chose concise for loadability)
Successfully implemented the MVP scope of the OpenHands integration for Agentic Agile-V. The foundation is solid:
β
Control separation: Agile-V controls acceptance, OpenHands executes
β
Skills teach: Five skills for progressive disclosure
β
Hooks enforce: Seven lifecycle hooks with mechanical gates
β
Policies guide: Risk-based evidence requirements
β
Context resolves: Flexible task ID resolution
The integration is additive (doesn't break existing workflows), safe (fail-closed on ambiguity), and extensible (ready for Phases 5-12).
Next Priority: Phase 5 (Evidence schema extension) and Phase 6 (Evidence adapter) to close the loop between OpenHands execution and Agile-V validation.
- Implementation Plan:
/Users/chris/Downloads/agentic_agile_v_openhands_implementation_plan.md - ADR:
docs/adr/ADR-0001-openhands-execution-backend.md - Integration Guide:
docs/integrations/openhands.md - Test Script:
test_openhands_integration.py - Repository:
/Users/chris/Dev/agile-v/agentic_agile_v
Implemented by: OpenCode Agent
Date: 2026-06-08
Phases Completed: 0-4 of 12
Status: MVP Ready for Testing