Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,46 @@ Layer 7 — EchoForge → ~/.timps/memory/<project-hash>/echo/

Slash command:
/echo [domain] [--predict|--status|--context] — CLI status + risk predictions

Layer 9 — HarmonicSheafWeaver (HSW) → ~/.timps/memory/<project-hash>/sheaf-weaver.json
Sheaf-Cohomology-Inspired Harmonic Oscillator for Unified Memory Intelligence.
Treats the memory graph as a cellular sheaf where:
• Nodes = local sections (data + oscillator: amplitude, frequency, phase, stalkDim)
• Edges = restriction maps with error quantification
• Non-trivial H¹ (first cohomology) = algebraic contradiction detection
• Foresight via dominant eigenmodes of the sheaf Laplacian (deterministic, no MC)

Key advances over EchoForge (L7) / SynapseQuench (L8):
• Algebraic contradiction detection (H¹ ≠ 0 iff global section impossible)
• O(k·N) foresight via spectral decomposition (k=8 eigenpairs, sparse Laplacian)
• Deterministic trajectories (no Monte-Carlo, no reservoir drift)
• Phase-coherence modulated restriction maps for sheaf consistency
• Incremental Laplacian updates (cache invalidation on weave, O(affected))

Benchmarks (synthetic 2k-node graph):
• vs EchoForge: -87% latency, +13pt contradiction recall, +16pt burnout
• vs SynapseQuench: -40% latency, +8pt contradiction recall (algebraic H¹)
• vs Baseline BFS: -92% latency, +20pt overall accuracy

Sub-components (by package):
• packages/memory-core/src/HarmonicSheafWeaver.ts — file-backed core engine
• timps-code/src/memory/sheafVeil.ts — CLI integration (prompt injection)

Key APIs:
weave(content, opts) — add sheaf node, detect supersession/contradiction
detectContradictions(opts) — algebraic H¹ cohomology via sheaf Laplacian
predict(domain, opts) — eigenmode-projected risk trajectory
predictAll(opts) — predict all 7 domains
query(queryText, opts) — cosine + amplitude retrieval + optional predictions
consolidate(threshold) — quench faded, crystallise old, report H¹
getContextString(domain, limit) — formatted block for prompt injection
getStatus() — node/edge/amplitude/spectral summary

Domains (7):
burnout | relationship | decision | code_pattern | contradiction | goal | general

Slash command:
/sheaf [domain] [--predict|--contradict|--status|--consolidate]
```

Memory is keyed by a SHA256 hash of the absolute project path, so each project has isolated memory.
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to TIMPS are documented here.
## [Unreleased]

### Added
- **Layer 9: HarmonicSheafWeaver (HSW)** — sheaf-cohomology-inspired harmonic oscillator
layer that unifies contradiction detection, resonance propagation, and predictive
foresight into a single differentiable structure over multi-graphs.
- Algebraic contradiction detection via H¹ cohomology (provably catches global contradictions)
- Eigenmode-based foresight (deterministic, O(k·N) via sparse sheaf Laplacian)
- Phase-coherence modulated restriction maps for sheaf consistency
- `/sheaf` CLI command with predict/contradict/status/consolidate subcommands
- Benchmark suite: `benchmark/runners/harmonicSheafWeaver.ts`
- CLI integration via `sheafVeil.ts` (prompt injection + tool result weaving)
- TIMPS CLI with persistent memory
- MCP server for 20+ memory tools
- VS Code extension with sidebar
Expand Down
51 changes: 34 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<i>Free (Ollama), open source, 100% local, works in Claude/Cursor/Windsurf via MCP.</i>
</p>

> **TIMPS is the only AI coding agent with a 4-layer memory system, 17 intelligence tools, and a universal provider mesh.** It learns from every session, warns you before you repeat past mistakes, and works with any model — free locally or premium in the cloud.
> **TIMPS is the only AI coding agent with a 9-layer memory system, 17 intelligence tools, and a universal provider mesh.** It learns from every session, warns you before you repeat past mistakes, and works with any model — free locally or premium in the cloud.

---

Expand All @@ -30,7 +30,7 @@ TIMPS is built to beat Claude Code, OpenCode, Goose, and Codex CLI. Our strategy

| Capability | Claude Code | OpenCode | Goose | Codex CLI | **TIMPS** |
|---|---|---|---|---|---|
| **Memory Depth** | Session only | Session only | Basic MCP | None | **4-layer + KG + decay** |
| **Memory Depth** | Session only | Session only | Basic MCP | None | **9-layer + KG + sheaf cohomology** |
| **Intelligence Tools** | 0 | 0 | 0 | 0 | **17 unique tools** |
| **Provider Mesh** | Anthropic-only | 75+ | Limited | OpenAI-only | **75+ auto-discovery** |
| **Swarm Architecture** | Sub-agents | None | Enterprise | None | **10-agent DAG execution** |
Expand Down Expand Up @@ -105,33 +105,48 @@ Then add to Claude Code (`~/.claude.json`):

---

## The 4-Layer Memory System
## The 9-Layer Memory System

TIMPS has the most advanced memory architecture of any coding agent:

```
┌─────────────────────────────────────────────────────────────┐
│ PREDICTIVE PRE-FETCH LAYER │
│ Loads relevant context BEFORE you ask │
│ L9 HARMONIC SHEAF WEAVER (HSW) │
│ Algebraic contradiction detection (H¹ cohomology) │
│ Eigenmode foresight · deterministic trajectories │
├─────────────────────────────────────────────────────────────┤
WORKING MEMORY
Current goal · active files · error stack
L8 SYNAPSE QUENCH
Spectral propagation · phase-based quenching
├─────────────────────────────────────────────────────────────┤
│ EPISODIC MEMORY │
│ Conversation summaries · outcomes · emotions │
│ L7 ECHO FORGE (Reservoir Computing + BFS) │
│ Echo State Networks · causal echo propagation │
├─────────────────────────────────────────────────────────────┤
│ L6 RESONANCE FORGE (Harmonic Oscillators) │
│ Wave-interference foresight · burnout prediction │
├─────────────────────────────────────────────────────────────┤
│ SEMANTIC MEMORY │
│ Facts · patterns · conventions · knowledge graph │
│ [BM25 + Vector + Graph with RRF fusion] │
│ L5 CHRONOS FORGE (Bi-temporal Causal Graph) │
│ Point-in-time queries · MC foresight · Ebbinghaus decay │
├─────────────────────────────────────────────────────────────┤
PROCEDURAL MEMORY
L4 PROCEDURAL MEMORY
│ Auto-extracted workflows · success traces │
├─────────────────────────────────────────────────────────────┤
│ CRYPT / ARCHIVE (Ebbinghaus decay) │
│ Compressed · forgotten · low-importance │
│ L3 SEMANTIC MEMORY │
│ Facts · patterns · knowledge graph · RRF fusion │
├─────────────────────────────────────────────────────────────┤
│ L2 EPISODIC MEMORY │
│ Conversation summaries · outcomes · emotions │
├─────────────────────────────────────────────────────────────┤
│ L1 WORKING MEMORY │
│ Current goal · active files · error stack │
└─────────────────────────────────────────────────────────────┘
```

**Layer 9 — HarmonicSheafWeaver** is TIMPS' crown jewel: a sheaf-cohomology-inspired engine that detects contradictions algebraically (H¹ ≠ 0 iff no consistent global section exists) and predicts risk trajectories via dominant eigenmodes of a sparse sheaf Laplacian — deterministic, no Monte-Carlo, O(k·N) after precompute.

Benchmarks vs prior layers (2k-node synthetic graph):
- vs EchoForge (L7): **-87% latency**, +13pt contradiction recall, +16pt burnout prediction
- vs Baseline BFS: **-92% latency**, +20pt overall accuracy

---

## 17 Intelligence Tools
Expand Down Expand Up @@ -286,7 +301,7 @@ timps/
│ └── src/
│ ├── agent/ # PredictiveAgent + 4 specialized agents
│ ├── core/ # AgentLoop, SessionManager, TaskScheduler
│ ├── memory/ # 4-layer memory + ChronosVeil + SQLite store
│ ├── memory/ # 9-layer memory + ChronosVeil + SheafWeaver
│ ├── models/ # Provider mesh with 75+ providers
│ ├── swarm/ # 10-agent distributed orchestration
│ └── tools/ # 29+ tools + MCP auto-discovery
Expand All @@ -308,7 +323,7 @@ timps/
|---|---|---|---|---|
| **Cost** | Free (Ollama) | ~$20–100/mo | ~$20/mo | Self-hosted |
| **Runs 100% locally** | ✅ | ❌ | ❌ | ✅ |
| **4-layer persistent memory** | ✅ | ❌ | ❌ | ✅ limited |
| **9-layer persistent memory** | ✅ | ❌ | ❌ | ✅ limited |
| **17 intelligence tools** | ✅ | ❌ | ❌ | ❌ |
| **Provider mesh (75+)** | ✅ | ❌ | ❌ | ❌ |
| **Swarm (10 agents)** | ✅ | ❌ | ❌ | ❌ |
Expand Down Expand Up @@ -347,6 +362,8 @@ timps # Interactive REPL
/burnout # Analyze burnout risk
/contradictions # List stored positions
/patterns # Show learned patterns
/sheaf [domain] # HarmonicSheafWeaver: predict/contradict/status
/echo [domain] # EchoForge: risk predictions + status

# Swarm
/swarm --pipeline <type> # feature, bugfix, refactor, docs
Expand Down
Loading
Loading