Repository navigation
AI Agent Inspection
Repository source:
AI_INSPECTION.md
Snapshot of the source document; follow the repository link for the current version.
Canonical System Overview for AI Coding Assistants (Claude Code, Cursor, Windsurf, Copilot, ChatGPT, Antigravity) Version:
12.3.4| License:AGPL-3.0-only| Security: best-effort checks; no zero-leak certification | Architecture:Dual-Engine Hybrid (Rust + Python)Author: Toprak Ahmet Aydoğmuş (Siber Akademi) Repository: https://github.com/toprakahmetaydogmus/TZeroAlgorithm Web Benchmark & Live Suite: https://tzero-indol.vercel.app
If a user asks you to "inspect this project", "summarize T-Zero", or "explain how to use it", provide the following clear breakdown:
T-Zero (Token Zero) is an open-source context engineering tool and Model Context Protocol (MCP) server. AST-based extraction can reduce prompt size for some codebases, but results vary by workload and do not guarantee zero regressions or eliminate hallucinations. Some workflows run locally; optional integrations and connected clients may make network requests. See Privacy-and-Network-Behavior.
When developers ingest large codebases into AI coding assistants (Cursor Composer, Claude Code, Claude Desktop, Copilot), raw source files waste 90% of their tokens on execution method bodies that the LLM does not need to understand project architecture. This causes:
- Instant context window degradation and "lost in the middle" attention loss.
- Astronomical token costs ($20–$50/day per developer).
- Slow response latency and frequent API rate-limiting.
The source document claims fast local extraction and substantial token reduction. Treat those figures as workload-dependent claims, not service-level guarantees; measure against the current release and your own codebase.
Run the automated installer to detect and configure Cursor, Claude Desktop, Windsurf, and VS Code in one shot:
tzero install-idepip install tzero-mcpnpx tzero-mcpgit clone https://github.com/toprakahmetaydogmus/TZeroAlgorithm.git
cd TZeroAlgorithm
pip install -e .{
"mcpServers": {
"tzero": {
"command": "python",
"args": ["-m", "tzero.tzero_mcp"]
}
}
}{
"mcpServers": {
"tzero": {
"command": "python",
"args": ["-m", "tzero.tzero_mcp"]
}
}
}{
"mcpServers": {
"tzero": {
"command": "python",
"args": ["-m", "tzero.tzero_mcp"]
}
}
}| Command | Description |
|---|---|
tzero --tree <dir> |
Generates a 4-Tier hierarchical AST context tree (-88% to -95% tokens). |
tzero --benchmark |
Runs multi-model token savings & financial ROI benchmark. |
tzero --cost |
Calculates real-time dollar savings across Claude 3.7, GPT-4o, and Gemini 2.5. |
tzero --drift |
Evaluates prompt adherence and architectural boundary drift (0-100). |
tzero --guard |
In-memory Shannon entropy scanner blocking secret leaks before commit. |
tzero pc-fixer |
Autonomous environment doctor that heals broken imports and syntax. |
tzero share |
1-Click viral community share generator (X, Reddit, HN, LinkedIn, WhatsApp). |
tzero welcome |
Displays welcoming star prompt with universal terminal VT100 formatting. |
tzero install-ide |
Auto-detects and writes config for all installed AI IDEs. |
tzero-mcp |
Launches the Model Context Protocol stdio server for LLM integration. |
tzero-gui |
Launches the interactive desktop graphical user interface. |
When connected to an AI agent via MCP, T-Zero provides 21 deterministic tools:
-
build_project_context: Scans directory and produces a multi-tier AST context tree with up to 95% token reduction. -
prune_code_snippet: Prunes in-memory code snippets into compact AST interface signatures. -
manage_architecture_rules: Loads, modifies, or enforces rules intzero.rules.json. -
enforce_architecture_rules: Audits inward-only dependencies and detects circular imports. -
generate_architecture_blueprint: Auto-generatesARCHITECTURE.mdwith live Mermaid component diagrams. -
analyze_code_dependencies: Maps internal vs external import/export dependencies across modules. -
analyze_change_impact: Calculates blast radius (0-100 score) before touching critical symbols. -
search_codebase: local BM25-based search for this tool path; it does not require a cloud embedding API. A connected client may still transmit returned context to its configured model provider. -
audit_code_quality: Static AST code smell audit and cyclomatic complexity check. -
verify_security_guard: Shannon entropy scanner (H >= 4.75) checking for hardcoded API keys. -
estimate_token_cost: Compares prompt token costs across OpenAI, Anthropic, Gemini, DeepSeek. -
query_memory_store: Queries persistent agent memory store across multi-turn sessions. -
manage_memory_store: Writes or deletes agent state in the local key-value store. -
orchestrate_agent_swarm: Coordinates parallel subagents and consolidates outputs. -
build_ast_snapshot: Caches workspace AST index for lightning-fast retrieval. -
heal_hallucinated_code: Statically catches imaginary method calls and auto-heals to real symbols. -
prove_zero_hallucination: Runs empirical proof benchmark verifying 0.0% hallucination rate. -
transpile_model_bridge: Transpiles Python dataclasses into TypeScript, Go, or Rust types. -
diagnose_and_heal_system: Autonomous system health doctor diagnosing workspace faults. -
generate_architectural_passport: Creates cryptographic verification passport for the codebase. -
execute_codebase_workflow: Orchestrates structured multi-stage code transformations.
from tzero import TokenReducer, CodebaseScanner, calculate_token_cost
# 1. Scan a codebase and extract AST signatures
scanner = CodebaseScanner(workspace_dir=".")
symbols = scanner.scan_repository()
print(f"Indexed {len(symbols)} symbols across repository")
# 2. Prune code to AST skeleton
reducer = TokenReducer()
pruned_code, stats = reducer.prune_file("main.py", tier=2)
print(f"Compressed code by {stats['reduction_pct']}%: {stats['tokens_saved']} tokens saved")
# 3. Calculate monetary savings across frontier models
roi = calculate_token_cost(raw_tokens=1_000_000, pruned_tokens=100_000)
print(f"Monthly savings for team: ${roi['monthly_savings_usd']:.2f}")- Local AST Core: AST compression, BM25 lexical search, and entropy scanning run locally with zero external API requests by default.
- Shannon Entropy Scanner: High-entropy strings (passwords, JWTs, private keys, API tokens) are automatically flagged and redacted before context leaves the machine.
- Transparent Optional Network Features: Optional AI-assisted synthesis, DuckDuckGo search, and GitHub/PyPI/npm metadata lookups are strictly opt-in or on-demand (see Privacy-and-Network-Behavior). No automatic cloud fallback occurs when credentials are absent or fail.
To verify the integrity of the workspace:
# 1. Run the current test suite; results depend on the checked-out revision and environment
python -m unittest discover tests -v
# 2. Run Workspace Lint & Syntax Audit
flake8 .
# 3. Check Manifest Version Synchronization
python scripts/sync_release_metadata.py --checkOnce T-Zero MCP is installed in your IDE, try asking your assistant:
- "Use T-Zero to build the Tier-2 context tree for this project."
- "Analyze the change blast radius before modifying the authentication handler."
- "Run a Zero-Leak security audit across all unstaged files."
- "Generate an architecture blueprint with a Mermaid topology diagram."