A thinking-first agent framework built on Progressive Capture Theory
Project description
XYGLUE
A thinking-first agent framework that inserts a thinking layer between goal and plan, generating three ranked execution paths before any work begins.
The Problem
Every agent framework does this:
Goal → Plan → Execute → Output
The plan is a single path. If it fails, you get retries. If the approach was wrong, you get a faster wrong answer.
Nobody stops to ask: is the plan itself any good?
What XYGLUE Does Differently
XYGLUE inserts a thinking layer before planning. Three agents analyze the task, classify what's actually required vs. what's just convention, and generate three alternative paths — ranked from most creative to most safe.
┌─────────────────────────────────────────┐
│ THINKING LAYER │
│ │
│ ┌─────────┐ Every task has a │
Goal ────►│ │ Scout │ "standard" way. │
│ └────┬────┘ Scout maps it. │
│ │ │
│ ┌────▼──────┐ Which parts are physics │
│ │ Physicist │ (must do) vs habit │
│ └────┬──────┘ (just convention)? │
│ │ │
│ ┌────▼──────┐ Three paths: │
│ │ Architect │ A = break all habits │
│ └──┬──┬──┬──┘ B = break some │
│ │ │ │ C = optimized standard │
└─────┼──┼──┼─────────────────────────────┘
│ │ │
┌───────────────┼──┼──┼──────────────────────┐
│ EXECUTION LAYER │
│ │ │ │ │
│ Path A B C (with fallthrough) │
│ │ │ │ │
│ Self-healing pipeline │
│ 20 seeded failure patterns │
│ Checkpointing + rollback │
└───────────────┼──┼──┼──────────────────────┘
│ │ │
┌───────────────┼──┼──┼──────────────────────┐
│ CAPTURE LAYER │
│ │
│ Ground Tracker — records every run │
│ Template Library — quality ≥ 0.95, │
│ proven 2-3×, single failure resets │
└─────────────────────────────────────────────┘
│
▼
Brief
The key insight: Most of what developers assume is "required" is actually just convention. A REST API doesn't need Express. Auth doesn't need JWT. XYGLUE's Physicist separates what's actually constrained (physics) from what's just popular (habit) — then the Architect generates paths that break the habits.
Path A breaks everything. Path C plays it safe. Path B is the pragmatic middle. The engine runs A first, and if it fails, self-heals and falls through to B, then C. You get the upside of creative approaches with the safety net of conventional ones.
Installation
pip install xyglue
For AI-powered thinking (optional):
pip install xyglue[ai]
Quick Start
import asyncio
from xyglue import Engine
async def main():
engine = Engine()
result = await engine.run("Build a REST API for user management", mode="auto")
print(result.brief.format())
asyncio.run(main())
✅ Complete. Path A succeeded.
🔍 Scout benchmark: web. Standard: code, database.
2 habits broken. 0 physics respected.
No API key needed — every AI component has a rule-based fallback that works out of the box.
Two Modes
| Mode | What happens |
|---|---|
semi (default) |
Jarvis-style. Shows you the Brief with all three paths. You pick one. |
auto |
Full autonomous. Runs Path A → heals → falls through to B → C. |
# Semi: review before executing
engine = Engine()
result = await engine.run("Build a REST API")
print(result.brief.format()) # See the thinking
final = await engine.approve(result, path="A")
# Auto: just run it
result = await engine.run("Build a REST API", mode="auto")
Three Controls
| Control | Options | What it does |
|---|---|---|
mode |
semi, auto |
Pause for approval or run autonomously |
divergence |
low, medium, high |
How aggressively Path A breaks from convention |
learning |
supervised, auto |
Whether proven templates auto-promote or need your approval |
engine = Engine(
api_key="sk-ant-...", # Optional: AI-powered thinking
mode="semi",
divergence="high",
learning="supervised",
agents={ # Custom agent names (shown in Brief)
"scout": "Recon",
"physicist": "Newton",
"architect": "Blueprint",
},
)
The Thinking Layer
Three agents run in sequence before any execution happens:
Scout
Maps the benchmark — how is this task typically done? What tools, patterns, and sequence does everyone use? Also identifies cross-domain components that could apply but typically don't.
Physicist
Classifies every element the Scout found as either:
- Physics — can't change. Auth is required. TCP handshakes happen. Rate limits exist.
- Habit — just convention. REST is a choice. Express is a choice. PostgreSQL is a choice.
The Physicist is aggressive. Most things developers assume are necessary are just conventional.
Architect
Generates three paths from the classified map:
| Path | Strategy | Risk | Confidence |
|---|---|---|---|
| A | Maximum divergence. Break every habit. Pull cross-domain solutions. | High | Lower |
| B | Informed hybrid. Break habits selectively where the payoff is clear. | Medium | Medium |
| C | Optimized benchmark. The conventional approach, but enhanced. The floor. | Low | Higher |
The Healing Pipeline
When a step fails during execution, XYGLUE doesn't just retry blindly:
Failure → Detect → Classify → Match Pattern → Apply Fix → Retry
- Detector classifies the error (timeout, auth, rate limit, network, etc.)
- Pattern Library checks 20 seeded patterns for a known fix (fast path)
- Diagnoser runs rule-based or AI diagnosis if no pattern matches (slow path)
- Fix is applied and the step retries
Successful AI-diagnosed fixes get learned as new patterns. Patterns that fail lose confidence and eventually get evicted. The library improves over time.
The Capture Layer
Every run is recorded by the Ground Tracker — what was the benchmark, which constraints were classified, which path won, what failed and why.
The Template Library is intentionally strict:
- Quality threshold: 0.95 (non-negotiable)
- Must score 0.95+ on 2-3 separate runs to be promoted
- A single failure resets the validation counter
A library of 50 proven templates beats a library of 5,000 unvalidated ones.
Custom Tools
from xyglue import Tool, ToolResult
class MyTool(Tool):
@property
def name(self) -> str:
return "my_tool"
async def execute(self, params: dict) -> ToolResult:
return ToolResult(success=True, output="done")
engine = Engine()
engine.register_tool(MyTool())
Project Structure
xyglue/
__init__.py # Public API: Engine, RunResult, Brief, Tool, etc.
config.py # EngineConfig with all settings
engine.py # Main orchestrator (thinking → execution → capture)
sdk.py # Public Engine wrapper (one import, one class)
storage.py # SQLite persistence layer
thinking/ # Scout, Physicist, Architect agents
goal/ # Goal processing, normalization, entity extraction
plan/ # Plan models + checkpoint management
execute/ # Step executor with timeout, retry, fallback
heal/ # Failure detection → diagnosis → pattern match → fix
learn/ # Pattern library + 20 seed patterns
capture/ # Ground tracker + template library
brief/ # Brief output formatting
tools/ # Tool ABC, ToolResult, MockTool, ToolRegistry
Requirements
- Python 3.11+
aiosqlite>=0.19.0(only required dependency)anthropic>=0.25.0(optional, for AI-powered thinking)
Contributing
- Fork the repo and create a feature branch
- Install dev dependencies:
pip install -e ".[dev]" - Make changes
- Run checks:
pytest # 263 tests ruff check xyglue/ # Lint mypy xyglue/ # Type check
- Open a pull request
See CLAUDE.md for code conventions and how to add features.
License
MIT -- Copyright (c) 2026 Luke H
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xyglue-0.1.0.tar.gz.
File metadata
- Download URL: xyglue-0.1.0.tar.gz
- Upload date:
- Size: 71.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b1d60020db03298b94a1f9ebbe3ef8dcf050c7c88075177bf2b6ffd4e80ecf8
|
|
| MD5 |
96d0fb53e77a8197f2b4e7470c93909f
|
|
| BLAKE2b-256 |
239b65cdeb9725e6a80e129f4e5f822508360f7bda06d9564d98044e13556412
|
Provenance
The following attestation bundles were made for xyglue-0.1.0.tar.gz:
Publisher:
publish.yaml on mintingpressbuilds/XYGLUE
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xyglue-0.1.0.tar.gz -
Subject digest:
1b1d60020db03298b94a1f9ebbe3ef8dcf050c7c88075177bf2b6ffd4e80ecf8 - Sigstore transparency entry: 928741940
- Sigstore integration time:
-
Permalink:
mintingpressbuilds/XYGLUE@0298072efff286eade77f94e5271b0d70769a48a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mintingpressbuilds
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@0298072efff286eade77f94e5271b0d70769a48a -
Trigger Event:
release
-
Statement type:
File details
Details for the file xyglue-0.1.0-py3-none-any.whl.
File metadata
- Download URL: xyglue-0.1.0-py3-none-any.whl
- Upload date:
- Size: 69.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ffe45a8da52441895ed4891882cfc247f78e916c6fffe51c3b5f0aad6d7706b
|
|
| MD5 |
44ec6cfb8bf34add4b98e472b2a9e709
|
|
| BLAKE2b-256 |
01155847e946aa1a4ff645239d8495f194620ee66dff3678a580addf2b227ab1
|
Provenance
The following attestation bundles were made for xyglue-0.1.0-py3-none-any.whl:
Publisher:
publish.yaml on mintingpressbuilds/XYGLUE
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xyglue-0.1.0-py3-none-any.whl -
Subject digest:
2ffe45a8da52441895ed4891882cfc247f78e916c6fffe51c3b5f0aad6d7706b - Sigstore transparency entry: 928741946
- Sigstore integration time:
-
Permalink:
mintingpressbuilds/XYGLUE@0298072efff286eade77f94e5271b0d70769a48a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mintingpressbuilds
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@0298072efff286eade77f94e5271b0d70769a48a -
Trigger Event:
release
-
Statement type: