Skip to main content
TENET is a collection of components that work together to create a learning system for AI agents.

System Overview

+------------------------------------------------------+
| Your Project (.jfl/)                                 |
|                                                      |
|  +-------------+  +-------------+  +--------------+|
|  | Journal     |  | Training    |  | Agent        ||
|  | (JSONL)     |  | Buffer      |  | Configs      ||
|  |             |  | (JSONL)     |  | (TOML)       ||
|  +------+------+  +------+------+  +------+-------+|
|         |                |                |         |
|  +------v----------------v----------------v-------+ |
|  |              Context Hub (:4360)                | |
|  |  Memory DB | Event Bus | Periodic Indexer      | |
|  +------+-------------+--------------+------------+ |
|         |             |              |              |
|  +------v------+ +----v-----+ +-----v------+      |
|  | Memory      | | Flow     | | Eval       |      |
|  | Search      | | Engine   | | System     |      |
|  | (BM25+RRF)  | | (YAML)   | | (scripts)  |      |
|  +-------------+ +----------+ +------------+      |
|                                                      |
|  +-------------+  +-------------+                   |
|  | Peter       |  | Policy      |                   |
|  | Parker      |  | Head        |                   |
|  | (orchestr.) |  | (14M param) |                   |
|  +-------------+  +-------------+                   |
+------------------------------------------------------+
         |                    |
    +----v----+          +----v----+
    | Pi      |          |Subway   |
    | Runtime |          | Mesh    |
    +---------+          +---------+

Components

Context Hub

The central coordination daemon. Runs locally on a port (default 4360).
  • Memory database — SQLite with 349+ indexed memories, semantic embeddings, graph edges
  • Event bus — MAP (Multiplayer Agent Protocol) events for agent coordination
  • Periodic indexer — Indexes journal entries every 60s, code headers every 5 min, auto-backfills embeddings
  • API server — REST endpoints for memory, events, context, eval

Journal System

Append-only JSONL files that capture everything that happens:
  • Features, fixes, decisions, discoveries
  • Session starts and ends
  • Pivots (context checkpoints)
  • Agent actions and outcomes
The journal is the source of truth. Memory, training data, and knowledge docs are all derived from it.

Memory System

Hybrid search combining lexical (BM25+) and semantic (embeddings):
  • 349+ memories with text-embedding-3-small embeddings
  • Graph edges: updates, contradicts, related_to, caused_by, part_of
  • Code header indexing: @purpose annotations → searchable knowledge
  • Reciprocal Rank Fusion for combining lexical and semantic results

Eval System

Bash or TypeScript scripts that measure real metrics:
  • eval/test-coverage.sh — jest --coverage percentage
  • eval/code-quality.sh — console.logs, any usage, @purpose coverage
  • eval/product-metrics.sh — startup speed, session reliability, hub uptime
  • eval/cli-speed.sh — p90 command latency
Each script outputs JSON with a primary metric. The agent harness compares before/after.

Peter Parker

Meta-orchestrator that coordinates the nightly improvement loop:
  1. Mines training tuples from journals
  2. Synthesizes product context
  3. Uses Stratus for strategic reasoning (which agents to run)
  4. Runs agents with budgeted rounds
  5. Picks up kanban backlog items

Policy Head

14M-parameter transformer (4-layer, 512 hidden, 8 heads) trained on the training buffer:
  • Input: system state (scores, trajectories, agent history)
  • Output: predicted reward for each candidate action
  • Trained on MPS (Apple Silicon), retrained nightly when 50+ new tuples

Flow Engine

YAML-defined automation flows:
  • Cron triggers (every 30 min, daily)
  • Event triggers (eval:scored, kanban:pickup)
  • Actions: commands, journal entries, agent spawns
  • Gates: approval requirements, cooldowns, iteration limits

Subway Mesh

P2P agent coordination via WebSocket relay:
  • Agents register as name.relay
  • Send/receive messages, RPC calls
  • Pub/sub topics for broadcasts
  • Enables multi-agent coordination across machines

File Structure

your-project/
+-- .jfl/
|   +-- config.json              # Project configuration
|   +-- journal/                 # Session journals (JSONL)
|   +-- agents/                  # Agent configs (TOML)
|   +-- flows/                   # Automation flows (YAML)
|   +-- training-buffer.jsonl    # RL training data
|   +-- memory.db                # SQLite memory database
|   +-- eval.jsonl               # Eval score history
|   +-- checkpoints/             # Policy head weights
+-- eval/                        # Eval scripts
+-- knowledge/                   # Knowledge docs (Markdown)
+-- CLAUDE.md                    # Agent instructions
+-- AGENTS.md                    # Pi agent instructions

Local-First

Everything runs on your machine. No cloud dependency:
  • Context Hub is a local daemon
  • Memory is SQLite
  • Training data is JSONL files
  • Policy head trains on MPS/CPU
  • Git is the transport layer
API keys needed only for: LLM calls (Claude/GPT) and embeddings (OpenAI/OpenRouter).