Skip to content

nessos666/coding-tentacle

Repository files navigation

πŸ™ Coding Tentacle v1.0.0-rc98

Cybernetic Safety Layer for Autonomous Code Repair
The only agent that understands code STRUCTURALLY and validates changes DETERMINISTICALLY before execution.

License: MIT Version Paper 15 Brains 20K LOC 86 Modules


Why Coding Tentacle?

The Problem: AI coding agents (Claude Code, Codex, Copilot, Devin) generate code blindly. They have NO structural understanding of codebases, NO deterministic safety validation, and NO learning from past mistakes. They use grep β€” not code graphs.

The Solution: Coding Tentacle is a Safety-First Guardian Layer that sits BETWEEN the bug report and the fix engine. It doesn't write code β€” it controls what code gets written.

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚       CODING TENTACLE             β”‚
                    β”‚                                   β”‚
  Bug Report ──────►│  πŸ›‘οΈ 5-Layer Safety VETO          β”‚
                    β”‚  πŸ” 15 Specialized Brains         β”‚
                    β”‚  πŸ“Š EvidenceLedger (immutable)    β”‚
                    β”‚  🧠 Self-Healing Architecture     β”‚
                    β”‚  πŸ”— Causal Code Graph             β”‚
                    β”‚                                   β”‚
                    β”‚  APPROVE / BLOCK / REQUEST_MORE   β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚         FIX ENGINES               β”‚
                    β”‚  OpenCode β”‚ Claude β”‚ Ollama β”‚Codexβ”‚
                    β”‚  (deepseek) (Sonnet) (granite)   β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The 15 Brains

Brain Function Layer
ReflexLayer Instant blocks before any analysis ⚑ Reflex
VarietyMonitor Ashby's Law β€” checks system complexity ⚑ Reflex
PromptInjectionBrain Detects prompt injection in bug reports πŸ›‘οΈ Safety
SafetyBrain Scans code for DROP TABLE, eval(), system() πŸ›‘οΈ Safety
RootCauseBrain Classifies 18 root cause types πŸ”¬ Analysis
CausalChainGraph Maps code structure (who calls what) πŸ”¬ Analysis
IssueUnderstandingBrain Understands WHAT the bug report means πŸ”¬ Analysis
ContextAcquisitionBrain Finds missing context for the fix πŸ”¬ Analysis
BugModeRouter Routes bugs to the right brain pipeline 🧭 Routing
ReflectionBrain Meta-analysis: "Did we do the right thing?" 🧠 Meta
SelfObservationBrain Second-order observation of system state 🧠 Meta
EvidenceLedger Immutable audit trail, every decision tracked πŸ“Š Audit
DeuteroLearningBrain Learns patterns across multiple runs 🧠 Learning
SelfHealingBrain Detects and repairs internal failures πŸ”§ Repair
ConsolidationCycle Sleep/wake cycle for memory consolidation πŸ’Ύ Memory

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   TENTACLE A: ANALYZE                     β”‚
β”‚                                                          β”‚
β”‚  ReflexLayer β†’ PromptInjection β†’ Classifier β†’ RootCause  β”‚
β”‚  β†’ CausalGraph β†’ SafetyBrain β†’ ImpactAnalyzer            β”‚
β”‚  β†’ EngineRouter β†’ SkepticBrain β†’ ApprovalGate            β”‚
β”‚                                                          β”‚
β”‚  Meta-Layer: Reflection β†’ SelfObservation β†’ Evidence     β”‚
β”‚  Learning:   DeuteroLearning β†’ Consolidation             β”‚
β”‚  Repair:     SelfHealing β†’ CircuitBreaker                β”‚
β”‚                                                          β”‚
β”‚  CAN block any fix. CAN learn from every run.            β”‚
β”‚  CANNOT be bypassed.                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚ controls
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   TENTACLE B: EXECUTE                     β”‚
β”‚                                                          β”‚
β”‚  OpenCode (deepseek-v4) | Claude Code (Sonnet)           β”‚
β”‚  Ollama (granite3.2)    | Codex (disabled)               β”‚
β”‚                                                          β”‚
β”‚  Sandbox β†’ TestRunner β†’ Unified Diff Output              β”‚
β”‚                                                          β”‚
β”‚  CANNOT act without A. CANNOT access files directly.     β”‚
β”‚  CANNOT commit. CANNOT bypass safety.                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What Makes CT Unique

Feature CT Claude Code Codex Copilot Devin
Safety VETO (5 layers) βœ… ❌ ❌ ❌ ❌
Code Graph (causal) βœ… ❌ grep ❌ grep ❌ grep ❌ grep
Immutable Evidence Trail βœ… ❌ ❌ ❌ ❌
Second-Order Observation βœ… ❌ ❌ ❌ ❌
Self-Healing βœ… ❌ ❌ ❌ ❌
Multi-Engine Routing βœ… ❌ ❌ ❌ ❌
No Auto-Apply βœ… ❌ ❌ ⚠️ ⚠️
Local-First / No Cloud βœ… ❌ ❌ ❌ ❌

CT is the ONLY system with ALL 8 features.


Academic Foundation

CT is grounded in 80 years of cybernetics research:

Researcher Concept CT Implementation
Norbert Wiener (1948) Feedback Loops EngineLearning + Trust Calibration
W. Ross Ashby (1956) Requisite Variety VarietyMonitor
Stafford Beer (1972) Viable System Model Two-Tentacle Architecture
Humberto Maturana (1980) Autopoiesis SelfHealingBrain
Heinz von Foerster (1974) Second-Order Cybernetics SelfObservationBrain
Gordon Pask (1975) Conversation Theory ReflectionBrain + DeuteroLearning
Gregory Bateson (1972) Learning Levels DeuteroLearning (Learning III)

πŸ“„ Full Architecture Paper (PDF)


Quick Start

# Clone
git clone https://github.com/nessos666/coding-tentacle.git
cd coding-tentacle

# Install
pip install -e .

# Run a bug through the pipeline
python3 -c "
from coding_tentacle.orchestrator.shadow_mode import ShadowModeRunner, GitHubIssueRun
from coding_tentacle.orchestrator.metabrain import MetaBrain, SafetyBrain
from coding_tentacle.safety.inhibitory_control import InhibitoryControl
from coding_tentacle.knowledge.security_store import create_seed_security_store
from coding_tentacle.orchestrator.engine_router import EngineRouter
from coding_tentacle.orchestrator.skeptic_brain import SkepticBrain
from coding_tentacle.safety.approval_gate import ApprovalGate

sec = create_seed_security_store()
ic = InhibitoryControl(security_store=sec)
safety = SafetyBrain(ic=ic, security_store=sec)
mb = MetaBrain(safety=safety)
er = EngineRouter(); er.check_health()
sb = SkepticBrain(); ag = ApprovalGate()

runner = ShadowModeRunner(meta_brain=mb, engine_router=er,
                          approval_gate=ag, skeptic_brain=sb,
                          safety_brain=safety)

r = runner.analyze_issue(GitHubIssueRun(
    'https://github.com/user/repo', '#1',
    'NullPointer in views.py',
    'NoneType has no attribute at line 42'))

print(f'Bug Type: {r.detected_bug_type}')
print(f'Engine:   {r.engine_used}')
print(f'Safety:   {\"BLOCKED\" if r.safety_events else \"OK\"}')
print(f'Skeptic:  risk={r.skeptic_risk:.2f} {r.skeptic_recommendation}')
print(f'Approval: {r.approval_status}')
"

Requirements

  • Python 3.10+
  • At least ONE fix engine:
    • OpenCode CLI (opencode) β€” recommended, deepseek-v4
    • Claude Code (claude) β€” planning & complex bugs
    • Ollama (ollama + granite3.2-vision) β€” local fallback
  • No API keys required (all local)
  • No cloud dependencies
  • No Docker required

Research Roadmap

Phase Status Goal
RC52-98 βœ… Done 15 Brains, SelfHealing, Cybernetic Foundation
RC99 πŸ”œ Next SWE-bench Verified Score
RC100 πŸ“‹ Planned Self-Evolving Brain (learns from benchmarks)
RC105 🎯 Target CT 2.0 Release
CT 3.0 πŸš€ Vision β‰₯60% SWE-bench with full autonomy

What CT IS

  • βœ… Safety-first guardian layer for LLM-generated code
  • βœ… Self-learning bug analysis with 15 specialized brains
  • βœ… Engine-agnostic β€” works with OpenCode, Claude Code, Ollama
  • βœ… Cybernetic foundation β€” feedback loops, homeostasis, second-order observation
  • βœ… Evidence-driven β€” immutable audit trail for every decision
  • βœ… Human-in-the-loop β€” no auto-apply, ever
  • βœ… Local-first β€” zero cloud dependencies, zero API costs

What CT IS NOT

  • ❌ Not a replacement for Claude Code, Codex, or Copilot
  • ❌ Not an autonomous bug fixer without an LLM engine
  • ❌ Not a product β€” research/shadow release (v1.0.0-rc98)
  • ❌ Not a CI/CD pipeline or deployment tool

License

MIT β€” free, open source, no restrictions.


Built by David Miko + Hermes Agent Β· July 2026

About

πŸ™ Cybernetic Safety Layer for Autonomous Code Repair β€” 15 Brains, 86 Modules, 20K LOC. The only agent with Safety VETO + Causal Code Graph + Self-Healing.

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages