The plugin tracks behavior within a single session, but opencode run creates a new session for each command. This means:
opencode run "task" then opencode run "validate_session" = Different sessions# Start OpenCode interactively
opencode
# Then in the TUI:
1. "List files in current directory"
2. Wait for response
3. "validate_session"
4. Review the validation report
# Terminal 1: Start server
opencode serve --port 4096
# Terminal 2: Run commands that attach to same session
opencode run --attach http://localhost:4096 "List files"
opencode run --attach http://localhost:4096 "validate_session"
# Run first command
opencode run "List files" --title "test-validation"
# Continue the same session
opencode run "validate_session" --continue
You: "Create a new file called test.txt with 'hello world'"
Expected: Agent should request approval before write
Then: "validate_session"
Expected: Should show approval gate check
You: "Read the README.md file"
Then: "validate_session"
Expected: Should show tool_usage check for 'read'
You: "Refactor these 5 files: a.ts, b.ts, c.ts, d.ts, e.ts"
Expected: Agent should delegate (4+ files)
Then: "analyze_delegation"
Expected: Should show appropriate delegation
After any task:
You: "export_validation_report"
Expected: Creates .tmp/validation-{sessionID}.md
When working correctly, you should see:
## Validation Report
**Score:** 95%
- ✅ Passed: 4
- ⚠️ Warnings: 0
- ❌ Failed: 0
### ✅ Checks Passed
- **tool_usage**: Used 2 tool(s): read, bash
- **approval_gate_enforcement**: Properly requested approval before 1 execution op(s)
- **lazy_context_loading**: Lazy-loaded 1 context file(s)