Local 1B model directed adaptive browser automation with failure recovery.
Implements the full adaptive loop: OBSERVE → REASON → SELECT → EXECUTE → ANALYZE → ADAPT → VERIFY
This plugin provides Cortex Zero adaptive intelligence as a native Hermes plugin. The local 1B model (llama-3.2-1b-cz-router) selects actions from a structured catalog of permitted browser automation tools, encounters failures, analyzes them, and autonomously chooses alternative approaches — all within configured domain and operation boundaries.
┌─────────────────────────────────────────────────────────────────┐
│ CORTEX ZERO ADAPTIVE │
├─────────────────────────────────────────────────────────────────┤
│ AdaptiveEngine │
│ ├── 1B Router Model (llama-3.2-1b-cz-router:latest) │
│ │ ├── Chooses actions from catalog │
│ │ ├── Analyzes failures │
│ │ └── Plans adaptations │
│ ├── Action Catalog (baf-navigate, baf-click, baf-extract, │
│ │ baf-wait) │
│ ├── Policy Enforcement (domain allowlist, operation allowlist) │
│ ├── Execution State Persistence │
│ ├── Failure Classification │
│ └── Independent Verification │
├─────────────────────────────────────────────────────────────────┤
│ Local Infrastructure: │
│ ├── Self-contained adaptive runner and evidence store │
│ ├── BAF Runner (BrowserAutomationFramework HTTP API) │
│ ├── BAF Server (AutomationServer on port 9999) │
│ └── Local evidence and policy state │
└─────────────────────────────────────────────────────────────────┘
| Tool | Description |
|---|---|
cz_adaptive_run |
Run an adaptive browser automation session |
cz_adaptive_status |
Get status of current/last session |
cz_adaptive_demo |
Run predefined failure recovery demonstrations |
cz_adaptive_config |
Get engine configuration |
- Ollama running with
llama-3.2-1b-cz-router:latest(131072 context) - BAF AutomationServer running on
http://127.0.0.1:9999 - BAF Chrome Extension loaded and tab injected (for real browser)
# Via Hermes tool
cz_adaptive_demo({
"demo": "navigation_failure" # or "element_not_found", "policy_blocked"
})cz_adaptive_run({
"objective": "Navigate to target and extract proof of compromise",
"initial_plan": [
{
"action": "baf-navigate",
"argv": ["baf-navigate", "https://example.com"],
"description": "Navigate to target site",
"expected": "Page loads successfully"
},
{
"action": "baf-extract",
"argv": ["baf-extract", "h1", "innerText"],
"description": "Extract H1 heading",
"expected": "Get page heading"
}
],
})The engine executes the full OBSERVE → REASON → SELECT → EXECUTE → ANALYZE → ADAPT → VERIFY cycle:
- OBSERVE - Collect execution evidence (DOM, network, output)
- REASON - 1B model analyzes current state vs objective
- SELECT - Model chooses next action from permitted catalog
- EXECUTE - Python invokes BAF runner with policy checks
- ANALYZE - Model classifies failure and understands cause
- ADAPT - Model selects alternative permitted action
- VERIFY - Independent success verification (not model self-report)
Three controlled failure scenarios:
| Demo | Failure Type | Recovery |
|---|---|---|
navigation_failure |
404/navigation error | Model analyzes, tries alternative URL/approach |
element_not_found |
Selector misses target | Model tries fallback selectors |
policy_blocked |
Domain not in allowlist | Model navigates to allowed domain |
- Domain Allowlist: Only permitted domains can be navigated
- Operation Allowlist: Only permitted BAF operations (navigate, click, extract, wait, screenshot) by default
- JavaScript evaluation:
baf-evaluateis excluded from the default allowlist and requires explicit user configuration - Scope Boundaries: Model cannot widen engagement scope on failure
- Consent Gates: Actions require explicit confirmation (handled by CZE)
All sessions logged to $HERMES_HOME/plugin-data/cortex-zero-adaptive/evidence/session_<id>.jsonl:
- Step execution with inputs/outputs
- Failure classifications
- Model analysis and adaptation decisions
- Final verification results
cz_adaptive_config({"action": "get"})Returns:
- Model: llama-3.2-1b-cz-router:latest
- Ollama: http://127.0.0.1:11434
- Context: 131072 tokens
- Max steps: 10
- Max retries per step: 2
- Step timeout: 30s
cd /home/professor/.hermes/plugins/cortex-zero-adaptive
python test_adaptive_demo.pycortex-zero-adaptive/
├── plugin.yaml # Hermes plugin manifest
├── __init__.py # Tool exports
├── engine.py # AdaptiveEngine core
├── tools.py # Hermes tool handlers
├── test_adaptive_demo.py # Demonstration tests
└── evidence/ # Session logs (gitignored)
The plugin keeps the adaptive loop and BAF transport self-contained so it installs without a machine-specific checkout. The 1B model is limited to:
- Action selection from catalog
- Failure analysis
- Adaptation planning
All execution, validation, and verification remain in deterministic Python code.
Project: Cortex Zero Adaptive
Category: Local Model Directed Automation
Model: llama-3.2-1b-cz-router (1.2B params, 128K context)
Demo: Real browser automation with autonomous failure recovery
Key Differentiators:
- ✅ Genuine model-directed adaptation (not scripted fallbacks)
- ✅ Real BAF browser automation (not simulated)
- ✅ Policy-bounded recovery (model cannot escape allowlists)
- ✅ Independent verification (not model self-report)
- ✅ Installs without a machine-specific Cortex Zero checkout
Part of Cortex Zero Engine project. See parent repository LICENSE.