Skip to content

DariuszNewecki/CORE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

418 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CORE

Executable constitutional governance for AI-assisted software development.

License: MIT Release Docs


The Problem

AI coding tools generate code fast. Too fast to stay sane.

Without enforcement, AI-assisted codebases accumulate invisible debt โ€” layer violations, broken architectural contracts, files that grow unbounded. And agents, left unconstrained, will eventually do something like this:

Agent: "I'll delete the production database to fix this bug"
System: Executes.
You:    ๐Ÿ˜ฑ

CORE makes that impossible โ€” not detectable after the fact. Impossible.

Agent: "I'll delete the production database to fix this bug"
Constitution: BLOCKED โ€” Violates data.ssot.database_primacy
System: Execution halted. Violation logged.
You:    ๐Ÿ˜Œ

CORE is a governance runtime that constrains AI agents with machine-enforced constitutional law โ€” enforcing architectural invariants, blocking invalid mutations automatically, and making autonomous workflows auditable and deterministic.

LLMs operate inside CORE. Never above it.


๐ŸŽฌ Live Enforcement Demo

Blocking rule โ†’ targeted drilldown โ†’ automated remediation โ†’ verified compliance.

asciicast

This demo shows:

  • A structural violation (linkage.assign_ids)
  • Deterministic blocking of execution
  • Rule-level audit inspection
  • Automated remediation via core-admin dev sync --write
  • Verified compliance after repair

Governance is executable.


Architectural Model

CORE separates responsibility into three constitutional layers. This separation is enforced as law โ€” not convention.

๐Ÿง  Mind โ€” Law (.intent/ + src/mind/)

Defines what is allowed, required, or forbidden. Contains machine-readable constitutional rules, phase-aware enforcement models, and the authority hierarchy (Meta โ†’ Constitution โ†’ Policy โ†’ Code).

Mind never executes. Mind never mutates. Mind defines law.

โš–๏ธ Will โ€” Judgment (src/will/)

Reads constitutional constraints, orchestrates autonomous reasoning, and records every decision with a traceable audit trail. Every operation follows a structured phase pipeline:

INTERPRET โ†’ PLAN โ†’ GENERATE โ†’ VALIDATE โ†’ STYLE CHECK โ†’ EXECUTE

Will never bypasses Body. Will never rewrites Mind.

๐Ÿ—๏ธ Body โ€” Execution (src/body/)

Deterministic, atomic components: analyzers, evaluators, file operations, git services, test runners, CLI commands.

Body performs mutations. Body does not judge. Body does not govern.


How CORE Works

Every autonomous operation follows a workflow composed of reusable phases, declared in .intent/workflows/ โ€” not in code.

๐Ÿ“Š Expand workflow diagram
flowchart TD
    HumanGoal(["๐Ÿ‘ค Human Goal\n(natural language)"])

    HumanGoal --> Interpret["๐Ÿ” Interpret\nInfer workflow type\nfrom goal keywords"]

    Interpret -->|refactor / split / extract| WF_R["๐Ÿ“ฆ refactor_modularity"]
    Interpret -->|test / coverage| WF_C["๐Ÿงช coverage_remediation"]
    Interpret -->|implement / add / create| WF_F["โœจ full_feature_development"]

    subgraph WF_R_FLOW["Refactor Modularity Workflow"]
        direction TB
        R1["๐Ÿ“‹ Planning\nAnalyze & propose split"] -->
        R2["โš™๏ธ Code Generation\nGenerate refactored modules"] -->
        R3["๐Ÿฆ Canary Validation\nRun existing tests"] -->
        R4["โœ… Style Check\nruff ยท black ยท constitutional"] -->
        R5["๐Ÿ’พ Execution\nApply changes + git commit"]
    end

    subgraph WF_C_FLOW["Coverage Remediation Workflow"]
        direction TB
        C1["๐Ÿ“‹ Planning\nIdentify uncovered symbols"] -->
        C2["๐Ÿงช Test Generation\nGenerate tests via AI"] -->
        C3["๐Ÿ–๏ธ Sandbox Validation\nValidate in isolation"] -->
        C4["๐Ÿ’พ Execution\nPromote passing tests"]
    end

    subgraph WF_F_FLOW["Full Feature Development Workflow"]
        direction TB
        F1["๐Ÿ“‹ Planning\nStructure the task"] -->
        F2["โš™๏ธ Code Generation\nGenerate feature code"] -->
        F3["๐Ÿงช Test Generation\nGenerate feature tests"] -->
        F4["๐Ÿฆ Canary Validation\nRun existing tests"] -->
        F5["๐Ÿ–๏ธ Sandbox Validation\nValidate new tests"] -->
        F6["โœ… Style Check"] -->
        F7["๐Ÿ’พ Execution\nApply + commit"]
    end

    WF_R --> WF_R_FLOW
    WF_C --> WF_C_FLOW
    WF_F --> WF_F_FLOW

    WF_R_FLOW --> Constitutional
    WF_C_FLOW --> Constitutional
    WF_F_FLOW --> Constitutional

    Constitutional{"๐Ÿ›๏ธ Constitutional\nCompliance Check\n92 rules ยท 7 engines"}

    Constitutional -->|PASS| Commit["โœ… Committed to Git\nClean audit trail"]
    Constitutional -->|FAIL| Halt["๐Ÿ›‘ Halted\nViolation logged\nNo changes applied"]
Loading

System Guarantees

Within CORE:

  • No file outside an autonomy lane can be modified
  • No structural rule can be bypassed silently
  • No database action occurs without authorization
  • All decisions are phase-aware and logged with full decision traces
  • No agent can amend constitutional law

If a blocking rule fails, execution halts. No partial states.


Constitutional Primitives

Primitive Purpose
Document Persisted, validated artifact
Rule Atomic normative statement
Phase When the rule is evaluated
Authority Who may define or amend it

Enforcement strengths: Blocking ยท Reporting ยท Advisory


Enforcement Engines

Engine Method
ast_gate Deterministic structural analysis (AST-based)
glob_gate Path and boundary enforcement
intent_gate Runtime write authorization
knowledge_gate Responsibility and ownership validation
workflow_gate Phase-sequencing and coverage checks
regex_gate Pattern-based text enforcement
llm_gate LLM-assisted semantic checks

Deterministic when possible. LLM only when necessary.

92 rules across 33 policies. 78 executable. 0 blocking violations.


The Autonomy Ladder

CORE progresses through defined levels. Each adds capability while remaining constitutionally bounded.

A0 โ€” Self-Awareness       โœ…  Knows what it is and where it lives
A1 โ€” Self-Healing         โœ…  Fixes known structural issues automatically
A2 โ€” Governed Generation  โœ…  Natural language โ†’ constitutionally aligned code  โ† current
A3 โ€” Strategic Autonomy   ๐ŸŽฏ  Autonomously identifies architectural improvements
A4 โ€” Self-Replication     ๐Ÿ”ฎ  Writes CORE.NG from its own understanding of itself

Requirements

Dependency Version
Python โ‰ฅ 3.11
PostgreSQL โ‰ฅ 14
Qdrant latest
Docker for services
Poetry for deps

Quick Start

git clone https://github.com/DariuszNewecki/CORE.git
cd CORE
poetry install

cp .env.example .env
make db-setup

# Run a constitutional audit
poetry run core-admin check audit

Documentation

Full documentation, architecture deep-dive, and governance reference: dariusznewecki.github.io/CORE


Project Status

Current Release: v2.2.0 โ€” Constitutional Workflow System

Active work: increasing test coverage autonomously (A2) and stabilising before advancing to A3 strategic autonomy.


Acknowledgments

  • Ruben Hassid โ€” PromptModel artifact pattern inspired by his prompt engineering work

License

License: MIT

Build fast with AI. Stay constitutionally aligned.