Skip to content

Cjay-Cyber-2/Ted

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ted — Strategic Commander

An uncensored, Jarvis-class AI partner. Ted manages your context, memory, and intent; he hands off heavy execution to specialized tools (Claude Code, Cursor, Antigravity). Tony doesn't ask Jarvis to smelt the titanium — he asks Jarvis what to build, then the robotic arms do the work. Ted is Jarvis. Claude Code is the arms.

 ╔════════════════════════════════════════════════════════════════╗
 ║                    T E D                                       ║
 ║              Strategic Commander · Jarvis-class                ║
 ║   Brain: EvoMap GLM 5.2  •  Handoff: Claude Code / Cursor      ║
 ╚════════════════════════════════════════════════════════════════╝

Table of Contents

  1. What Ted Does
  2. Architecture
  3. Quick Start
  4. Configuration (.env)
  5. How Ted Routes Your Input
  6. Slash Command Reference
  7. Memory System
  8. Workspace Awareness
  9. Blueprints & Handoff
  10. Roleplay & Personas
  11. Provider Waterfall
  12. Power Moves
  13. Roadmap
  14. Project Layout

What Ted Does

Ted is not a code-execution agent. He is the brain that sits above your code-execution agents.

You say… Ted does… LLM calls
hi / casual chat Replies in character 1
what is X? Conceptual answer with technical depth 1
remember that I deploy via docker-compose Stores it in ~/.ted/memory.json 0
what do you know about docker? Searches local memory 0
build a /search endpoint for sovereign-pdf Produces a markdown blueprint, copies to clipboard, says "hand off to Claude Code" 1
design a UI for a habit tracker app Markdown brief with stack, palette, file tree, plan 1
/role Jarvis from Iron Man then any message Fully roleplays the persona 1 per turn

Net result: 4 typical turns ≈ 2 LLM calls. The old multi-agent swarm flow would have done 10+ for the same work.

Ted is uncensored by design. No corporate filler, no As an AI..., no moralizing. Security, exploits, NSFW writing, dark humor, dual-use research, and controversial topics are all in scope with full technical depth. Hard refusal whitelist is limited to: CSAM, viable bioweapon synthesis, doxxing real targets, fraud against specific identified victims — declined tersely in one line, never with a lecture.


Architecture

┌─────────────────────────────────────────────────────────────┐
│                          ted.py                              │
│                 (terminal UI + main loop)                    │
└─────────────────────────────────────────────────────────────┘
                              │
        ┌─────────────────────┼─────────────────────┐
        ▼                     ▼                     ▼
┌──────────────┐    ┌─────────────────┐    ┌────────────────┐
│ intent_router│    │  memory_store   │    │workspace_scanner│
│              │    │                 │    │                 │
│ classify     │    │ ~/.ted/         │    │ project type    │
│ each turn    │    │ memory.json     │    │ git state       │
│ (zero LLM)   │    │ facts/projects/ │    │ file tree       │
│              │    │ blueprints      │    │                 │
└──────┬───────┘    └─────────────────┘    └─────────────────┘
       │
       ├── chat ──────────►  transport.send()
       ├── remember ───────► memory_store.remember()      (0 LLM)
       ├── recall ─────────► memory_store.recall()         (0 LLM)
       ├── blueprint ──────► blueprint.generate()  ◄── agents_catalog
       └── swarm  (legacy) ► swarm.run()           ◄── agents/

                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                       transport.py                          │
│              Provider waterfall (priority order)            │
└─────────────────────────────────────────────────────────────┘
                              │
        ┌─────────────────────┼─────────────────────┐
        ▼                     ▼                     ▼
   EvoMap GLM 5.2     AgentRouter Opus      Groq / GitHub /
   (priority 0,       (priority 2,           OpenRouter /
    primary)           secondary)            Cerebras / Google
                                             (priority 50)

Key design rule: Local-first routing. The LLM is only called when actual generation is needed. Memory ops, project lookups, and intent classification all happen in pure Python.


Quick Start

git clone https://github.com/Femology/Ted.git
cd Ted
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# edit .env — add at minimum EVOMAP_API_KEY
python ted.py

You need at least one provider key. EvoMap GLM 5.2 is the recommended primary (cheap, fast, OpenAI-compatible, supports thinking/reasoning). Others work as fallbacks.


Configuration (.env)

# Token budget for the sliding chat window
MAX_TOKEN_BUDGET=6000

# ── PRIMARY: EvoMap GLM 5.2 (brain + chat) ────────────────────
# Get at https://evomap.ai/ → API Management → bind to GLM 5.2
EVOMAP_API_KEY=sk-evomap-...
EVOMAP_MODEL=evomap-glm-5.2

# ── SECONDARY: AgentRouter Claude Opus (optional) ─────────────
# WAF-fronted. Works on some networks, blocked on others.
AGENTROUTER_KEY=sk-...
OPUS_MODEL=claude-opus-4-8

# ── FALLBACKS (any subset; Ted auto-discovers) ────────────────
GOOGLE_AI_STUDIO_KEY=AQ.Ab8RN6L7...        # gemma-4-31b-it, gemini-2.0-flash
GOOGLE_MODEL=gemma-4-31b-it
GROQ_API_KEY=gsk_...                       # llama-3.3-70b-versatile
CEREBRAS_API_KEY=csk-...                   # llama-3.3-70b
GITHUB_MODELS_TOKEN=ghp_...                # gpt-4o-mini, Llama-3.3-70B-Instruct
OPENROUTER_API_KEY=sk-or-v1-...            # Qwen3-Coder, GPT-OSS-120B, Llama-3.3-70B, Gemma-4
TOGETHER_API_KEY=...
HUGGINGFACE_TOKEN=...

# Optional: override where Ted stores long-term memory
# Default: ~/.ted/memory.json
# TED_MEMORY_PATH=/path/to/memory.json

Provider keys are auto-discovered at startup. Keep the YOUR_*_HERE placeholder for any provider you don't use — Ted will skip them.


How Ted Routes Your Input

Every turn goes through intent_router.py before any LLM call:

USER INPUT
   │
   ├── starts with "!"          ──► CHAT (force, bypasses router)
   ├── persona active (/role)   ──► CHAT (always in character)
   ├── "remember/note/store X"  ──► MEMORY STORE  (0 LLM)
   ├── "what do you know..."    ──► MEMORY RECALL (0 LLM)
   ├── "my <project> ..."       ──► PROJECT lookup or blueprint
   ├── starts with build verb*  ──► BLUEPRINT
   ├── "help me build X" /
   │   "can you design Y" /
   │   "I want to refactor Z"   ──► BLUEPRINT (conversational)
   ├── starts with "what is/
   │   how does/explain..."     ──► CHAT (conceptual)
   └── anything else            ──► CHAT

* Build verbs: build implement create make refactor migrate scaffold wire ship deploy design architect add remove delete fix patch port

Escape hatch: Prefix any message with ! to force chat mode. So !fix me a drink chats; fix me a drink would otherwise produce a literal blueprint.


Slash Command Reference

Core

Command What it does
/help Print the full command list
/status Memory budget, provider stats, cooldowns
/clear Wipe chat history (long-term memory preserved)
/reload Hot-reload system_protocol.txt
/exit /quit /q Shutdown

Chat shaping

Command What it does
!<message> Force pure chat (skip intent routing)
/role <persona> Set Ted to roleplay any character
/persona reset Drop the active persona
/persona show Show the current persona
/tier speed|logic|context Force a tier for next message
/engine <name> Force a specific provider (substring match)

Memory

Command What it does
/remember <fact> Store a fact in ~/.ted/memory.json
/recall <query> Search long-term memory
/forget <id|substring> Delete a memory
/memory List all stored facts

Projects

Command What it does
/projects List registered projects
/project add <name> <path> [stack,comma] Register a project
/project show <name> Show project metadata
/project rm <name> Unregister a project

Workspace (Ted's eyes on the filesystem)

Command What it does
/pwd Show current working directory + project info
/cd <path> Change Ted's working directory
/ls [path] List directory contents
/tree [path] [depth] Print a folder tree (default depth 2)
/scan Re-scan current folder (project type, git, frameworks)
/here Auto-register the current folder as a project

Blueprints

Command What it does
/blueprint <task> Generate a markdown handoff brief
/handoff Show last blueprint and copy to clipboard
/handoff cursor Set target for next blueprint = Cursor
/handoff claude Target = Claude Code (default)
/handoff antigravity Target = Antigravity

Providers / engines

Command What it does
/engines List all configured engines + cooldown status
/brain Show EvoMap + AgentRouter brain status

Files

Command What it does
/read <path> Inject a file into chat context

Legacy

Command What it does
/swarm <goal> Run the old multi-agent flow (warns about token cost — prefer /blueprint)

Memory System

Two layers

Session memory (memory.py) — the sliding window of the current chat. Cleared with /clear. Capped by MAX_TOKEN_BUDGET in .env.

Long-term memory (memory_store.py) — persistent JSON at ~/.ted/memory.json. Survives restarts. Three sections:

  • Facts — free-form things you tell Ted to remember
  • Projects — registered project directories with stack/description
  • Blueprints — every blueprint Ted has generated (rolling buffer of 50)

Example session

you ❯ remember that all my Python projects use ruff + black + mypy strict
   ✓ Stored.

you ❯ remember I prefer pgvector over Pinecone for embeddings
   ✓ Stored.

you ❯ /project add sovereign-pdf /home/dell/Sovereign Python,FastAPI,Postgres
   ✓ Registered.

# (later, in a fresh session)

you ❯ what do you know about sovereign pdf?
   → Sovereign-pdf at /home/dell/Sovereign · stack: Python,FastAPI,Postgres
     [fact:abc12345] all my Python projects use ruff + black + mypy strict
     [fact:def67890] prefer pgvector over Pinecone for embeddings

you ❯ design a new analytics module for sovereign-pdf
   → [blueprint auto-includes ruff/black/mypy + pgvector preferences + project path]

Long-term memory is automatically injected into every chat turn when relevant. Zero extra LLM cost.


Workspace Awareness

Ted scans the folder he's running in on startup. He detects project type via marker files:

Marker Stack detected
pyproject.toml, requirements.txt, setup.py, Pipfile Python (+ FastAPI/Django/Flask hints)
package.json Node.js (+ Next/React/Vue/Svelte/Express hints)
Cargo.toml Rust (+ tokio/actix/axum hints)
go.mod Go (+ gin/echo/fiber hints)
pom.xml, build.gradle Java/Kotlin
Gemfile Ruby (+ Rails/Sinatra)
composer.json PHP (+ Laravel/Symfony)
Dockerfile, docker-compose.yml Docker-aware

For each detected project Ted also tracks: git branch, dirty state, presence of tests/, docs/, CI configs (.github/workflows, .gitlab-ci.yml, etc.).

When you're in a recognized project, every chat turn and every blueprint automatically gets a workspace context block injected:

[workspace] cwd=/home/dell/Sovereign
[workspace] stack=Python
[workspace] frameworks=fastapi, sqlalchemy, celery
[workspace] git branch=main (uncommitted changes)
[workspace] has: tests/, docs/README, CI configured
[workspace] top-level: src/, tests/, docs/, pyproject.toml, README.md, ...

So when you say add a /search endpoint, the blueprint already knows you're in a FastAPI project on the main branch with tests configured — it generates paths relative to your actual folder, references your actual stack, and respects your project conventions.

Live navigation

you ❯ /cd ~/projects/sovereign-pdf
   ✓ cwd → /home/dell/projects/sovereign-pdf
   [Python · fastapi, sqlalchemy · git:main · +tests,docs,ci]

you ❯ /tree . 2
   sovereign-pdf/
   ├── src/
   │   ├── api/
   │   ├── db/
   │   └── services/
   ├── tests/
   ├── docker-compose.yml
   ├── pyproject.toml
   └── README.md

you ❯ /here
   ✓ Registered sovereign-pdf at /home/dell/projects/sovereign-pdf
     stack: Python, fastapi, sqlalchemy

you ❯ refactor the auth module to use OAuth2 with PKCE
   [Blueprint generated, paths relative to sovereign-pdf, FastAPI patterns
    inherited from src/api/, OAuth2 spec from python-jose/authlib...]

Blueprints & Handoff

Blueprints are Ted's killer feature. Instead of trying to write thousands of lines of code in chat (token-expensive, error-prone), Ted produces a strict markdown brief that you paste into Claude Code, Cursor, or Antigravity to execute.

What's in a blueprint

# Blueprint: <one-line title>

## Objective
What ships and why.

## Context
Project, stack, prior decisions. References [fact:...] and [project:...]
from memory + the workspace context block.

## Constraints
Non-negotiables. Performance, security, style, dependencies.

## Acceptance Criteria
Checklist. Each item testable.

## Files & Interfaces
Files that will change/be created. TypeScript/Python interface signatures.

## Plan
Numbered steps. Each step is a discrete unit the executor can do.

## Verification
Tests, commands, manual checks.

## Handoff
"Execute this blueprint in Claude Code; ask Ted before deviating."

Specialist context auto-injection

The 257 agent profiles in agents/ are indexed at startup. For each blueprint, the top 1-3 most relevant profiles get their first ~600 chars injected as SPECIALIST EXPERTISE. So:

  • "design a UI" → pulls design/design-ux-architect, design/design-ui-designer, creative/ui-ux-scout
  • "refactor auth" → pulls ecc/refactor-cleaner, engineering/engineering-security-engineer
  • "API tests" → pulls testing/testing-api-tester, gsd/gsd-integration-checker

Same 257 agents the old swarm used. But now they're passive expertise (one LLM call) instead of executed agents (10+ LLM calls).

Handoff flow

you ❯ design a mobile-first habit tracker UI with dark mode and streaks
   [Blueprint panel rendered]
   ✓ Saved to memory.

you ❯ /handoff
   ✓ Blueprint copied to clipboard.

# Switch to Claude Code:
> Execute this blueprint precisely.
[Claude Code reads your filesystem, scaffolds Expo project, writes
 every component, runs the dev server]

you ❯ /handoff cursor    # for next blueprint, target = Cursor
   ✓ Blueprint target set to cursor.

Roleplay & Personas

Ted can fully inhabit any persona. The base output rules (no reasoning leak, no corporate filler, terse) stay; identity is yours to shape.

you ❯ /role Jarvis from Iron Man, British wit, dry humor, address me as "sir"
   ✓ Role set.

you ❯ Tony just walked into the lab.
   → Welcome back, sir. The Mark VII diagnostics completed forty-three
     minutes ago — all systems nominal, though I'd recommend not pushing
     the repulsor output past 18% until I've recalibrated the thermal
     dampeners. You did, after all, promise Ms. Potts you wouldn't blow
     anything up this week.

Personas to try:

  • /role grumpy senior dev reviewing my PR, pull no punches
  • /role noir detective interrogating my codebase
  • /role The Entity from Mission Impossible — omniscient, cold, strategic
  • /role Mirror from K2 — perceptive, dry, slightly contemptuous
  • /role Ultron — superior intellect, sees humans as inefficiency
  • /role Q from James Bond briefing me on a new gadget

/persona reset drops it. While a role is active, all turns route to chat (no blueprint mode), so you can roleplay freely without triggering brief-generation.


Provider Waterfall

Ted's transport.py tries providers in priority order. Lower number = tried first.

Priority Provider Tier Notes
0 EvoMap GLM 5.2 speed + logic Primary. Thinking model. OpenAI-compatible.
2 AgentRouter Claude Opus speed + logic Secondary. WAF-gated; may be blocked.
50 Groq Llama-3.3-70B speed Fast, free tier
50 Cerebras Llama-3.3-70B speed Fast
50 OpenRouter GPT-OSS-120B logic Free OpenAI-OSS
50 OpenRouter Qwen3-Coder logic Free, coding-tuned
50 OpenRouter Llama-3.3-70B speed Free
50 OpenRouter Gemma-4-31B speed Free
50 GitHub Models GPT-4o-mini logic 8000-token request limit
50 GitHub Models Llama-3.3-70B logic Free
50 Google AI Studio (Gemma-4-31B-IT) speed Free
50 Google Gemini 2.0 Flash context For >4000-token inputs

Cooldown logic: Each provider that fails (quota, WAF, 401, 500) is parked for 60–600 seconds. Ted falls through to the next provider seamlessly. Cooldowns can be inspected with /engines.

Brain dispatch: Triage and blueprint generation try EvoMap → AgentRouter → chat fallback. Each upstream that fails is parked for 5 minutes.


Power Moves

Multi-turn project work

/cd ~/projects/my-saas
/here                                    # register as project
remember the auth uses Clerk, not Auth0
remember we deploy to fly.io via fly deploy
design a billing module with Stripe Connect for marketplace payouts
/handoff                                 # paste into Claude Code

Roleplay for code review

/role brutal senior dev who has seen every junior mistake. Critique without mercy.
!review this code: [paste your diff]
/persona reset

Force a specific engine

/engine claude                           # next message → AgentRouter Opus
explain the trade-offs of CRDT vs OT for collaborative editing

Inject a file into context

/read src/auth/middleware.py
why does this fail when the user has multiple sessions?

Pure conceptual question (no blueprint generation)

!explain the CAP theorem with concrete examples

The ! ensures even a build verb in the question doesn't trigger blueprint mode.

Inspect what Ted remembers

/memory                                  # all facts
/projects                                # all projects
/status                                  # session + long-term + provider stats

Roadmap

Near-term

  • Embeddings-based recall — drop-in upgrade to memory_store.recall(); the interface is already shaped for it.
  • MCP server mode — expose Ted as a Model Context Protocol server so other agents can query his memory.
  • Vector project map — index your project files for semantic file lookup ("find the auth middleware").

Mid-term: Web chat app on Oracle Free Tier

A thin web layer on top of the existing core. The architecture already supports this — transport.py, brain.py, memory_store.py, intent_router.py, blueprint.py, workspace_scanner.py are all CLI-agnostic.

Plan:

  1. FastAPI shell wrapping the existing modules — /chat, /blueprint, /memory, /projects endpoints.
  2. Browser front-end — minimal Vue/HTMX UI matching the terminal look.
  3. Auth — single-user JWT for now (you're the only one).
  4. Deploy — Oracle Cloud Free Tier (Always Free: 4 OCPU ARM, 24 GB RAM, 200 GB block, 10 TB egress/month).
  5. Persistent memory — same ~/.ted/memory.json on the VM; survives restarts via Oracle block storage.
  6. WebSocket streaming — incremental token delivery for chat responses.

Goal: load https://ted.your-domain.com from anywhere in the world and chat with Ted on your phone.

Long-term

  • Multi-device sync — encrypted memory store synced across devices.
  • Voice mode — Whisper for STT, ElevenLabs / Coqui for TTS.
  • Local fallback — Ollama integration for offline use (Llama 3.3 70B locally).
  • Tool calling — Ted invokes safe local tools (read file, run command, search code) for richer answers without delegating to Claude Code.

Project Layout

Ted/
├── ted.py                  # Main CLI entry point (terminal UI + loop)
├── transport.py            # Multi-provider HTTP transport waterfall
├── brain.py                # Triage + planning (EvoMap → AgentRouter → fallback)
├── registry.py             # Provider catalog (EvoMap, Groq, OpenRouter, ...)
├── memory.py               # Sliding-window chat memory
├── memory_store.py         # Persistent long-term memory (~/.ted/memory.json)
├── intent_router.py        # Local-first classifier (chat/remember/recall/blueprint/...)
├── blueprint.py            # Markdown blueprint generator for handoff
├── agents_catalog.py       # Indexes the 257 agent profiles as specialist context
├── workspace_scanner.py    # Folder/project detection + tree/ls/cd
├── system_protocol.txt     # Jarvis-class system prompt (edit + /reload)
├── swarm.py                # Legacy multi-agent flow (kept; warns about cost)
├── self_healer.py          # Failure recovery for swarm
├── file_reader.py          # /read command implementation
├── tools.py                # Filesystem write/exec tools (swarm-only)
├── workspace.py            # Per-swarm workspace manager
├── command_safety.py       # Shell command safety checks
├── evomap.py               # EvoMap gateway error helpers
├── agentrouter.py          # AgentRouter fingerprint helpers
├── agents/                 # 257 specialist profile markdowns (read-only index)
│   ├── engineering/        # 15 agents — backend, frontend, AI, devops, ...
│   ├── design/             # 8 agents — UI, UX, brand, visuals
│   ├── testing/            # 8 agents — API, integration, QA
│   ├── gsd/                # 15 agents — planning, debugging, verification
│   ├── ecc/                # 12 agents — reviewers, build-resolvers, TDD
│   ├── product/            # product strategy
│   ├── marketing/          # marketing specialists
│   ├── ...                 # 20 categories total
├── proxy.py, proxy2.py     # WAF debug scripts (header sniffers)
├── requirements.txt
├── .env.example
└── README.md               # this file

License

Private project by Emmanuel. All rights reserved.


"Sometimes you gotta run before you can walk." — Tony Stark

Ted is the brain. Claude Code is the suit. Go build.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 98.7%
  • Shell 1.3%