Labsco
johnnywuj81 logo

TokenKnows

โ˜… 2

from johnnywuj81

Capture AI coding sessions (Claude Code / Codex / Cursor) and distill them into weekly reports, ADRs and a knowledge graph โ€” self-hosted.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup
<p align="center"> <img src="assets/brand/png/logo-tile-512.png" alt="TokenKnows logo" width="140" /> </p> <h1 align="center">TokenKnows</h1> <p align="center"> Distill AI coding sessions into living knowledge โ€” weekly reports, ADRs, incident reviews, books, agent skills, and a knowledge graph. </p> <p align="center"> <a href="LICENSE"><img src="https://img.shields.io/github/license/johnnywuj81/tokenknows?color=d97757" alt="License"></a> <a href="https://github.com/johnnywuj81/tokenknows/actions/workflows/ci.yml"><img src="https://github.com/johnnywuj81/tokenknows/actions/workflows/ci.yml/badge.svg" alt="CI"></a> <img src="https://img.shields.io/badge/Claude_Code-plugin-d97757" alt="Claude Code plugin"> <img src="https://img.shields.io/badge/MCP-server-241b15" alt="MCP server"> <img src="https://img.shields.io/badge/PRs-welcome-788c5d" alt="PRs welcome"> </p> <p align="center"><b>English</b> | <a href="README.zh-CN.md">็ฎ€ไฝ“ไธญๆ–‡</a></p> <p align="center"> <img src="assets/demo/tokenknows-demo.gif" alt="TokenKnows demo: capture an AI coding session, distill it into a weekly report and knowledge graph" width="920" /> </p>

What is TokenKnows?

You spend hours pair-programming with Claude Code, Codex, and Cursor. The decisions, bug hunts, and design trade-offs from those sessions evaporate the moment the terminal closes. TokenKnows captures them automatically and distills them into structured, evidence-linked knowledge assets:

capture (6 collectors) โ†’ distill (5-stage LLM pipeline) โ†’ assets (7 document types) โ†’ review / redact / publish

  • ๐Ÿ“ก Captures everything โ€” Claude Code, Codex, Cursor, VS Code, GitHub PRs/commits/issues, and local docs, all via local file watchers and API polling. No webhooks, no tunnels.
  • ๐Ÿ“ Seven asset types โ€” weekly reports, tech designs, ADRs, incident reviews, long-form books, reusable agent skills (SKILL.md), and an entity knowledge graph.
  • ๐Ÿ”— Evidence-linked โ€” every paragraph traces back to the original PR / conversation / commit, ranked by cosine ร— trust ร— recency across โ‰ฅ2 sources.
  • ๐Ÿ”’ Local-first, zero egress by default โ€” a three-layer LLM egress gate (instance โˆง project โˆง task) with full audit logging. Pair it with Ollama and run the whole pipeline with zero cloud keys.

Demo

WorkbenchDocument page
Evidence drawerPublish receipt + version diff

โ–ถ Full walkthrough: engineering_handoff/walkthrough.mp4 (5 min, Chinese narration + subtitles)

<details> <summary>All 12 screens</summary>
1 Workbench2 Event drawer3 Document list4 Document page
5 Evidence drawer6 Regenerate dialog7 Review8 Redaction
9 Publish dialog10 Publish receipt + diff11 LLM egress12 Admin
</details>

Data collectors

All local โ€” no ngrok, no public webhooks. On macOS they restart on crash and on reboot (launchd).

CollectorSourceMode
claude-code~/.claude/projects/*.jsonl30s polling, incremental offsets
codex~/.codex/sessions/**/rollout-*.jsonl30s polling, incremental offsets
cursorCursor's state.vscdb (read-only SQLite)60s polling
githubGitHub REST API ยท PRs / issues / commits5min polling (gh auth token)
vscodeVS Code extension onDidSaveTextDocumentbuffered, 10s flush
local-docs~/Documents .md .txt .pdf (watchdog)realtime, 2s debounce
Copy & paste โ€” that's it
./scripts/launchd/install.sh          # macOS: install all 5 Python collectors as LaunchAgents
launchctl list | grep com.tokenknows
tail -f ~/Library/Logs/tokenknows/*.log

Every event carries a trust score (0.6 ร— source_authority + 0.4 ร— extraction_confidence); the evidence stage ranks citations by 0.6 ร— cosine + 0.25 ร— trust + 0.15 ร— recency and enforces โ‰ฅ2 distinct sources.

Architecture

Architecture overview

Collectors feed an event store (SQLite). A five-stage pipeline (collect โ†’ outline โ†’ content โ†’ evidence โ†’ assess) turns events into assets. The LLM Gateway unifies four providers (Anthropic / OpenAI / MiniMax / Ollama) with per-task routing and fallback chains โ€” and refuses any cloud call unless all three egress switches are on.

CI

WorkflowRunnerTrigger
ci.ymlubuntu-latest (GitHub-hosted)push to main + every PR
ci-macos.ymlself-hosted macOS ARM64maintainer pushes to main only โ€” never runs external PR code

Privacy & local-first

  • Zero egress by default โ€” cloud LLM calls require the instance and project and task switches all on
  • Bring your own keys; the audit log never leaves your machine
  • One-click kill switch drops the instance into fully-offline mode

Details: PRD ยง6.7 data residency & egress control (Chinese).

Documentation

TopicDoc
Product requirements, user journeysPRD (zh)
Technical design, API, schemaTDD (zh)
Macro architecture & milestonesArchitecture (zh)
Per-screen engineering decisionsTaskTechDesign (zh)
Pixel-level UI mockupsmockups/ โ€” open in a browser

Most in-depth docs are in Chinese (the project's working language). Code comments are predominantly Chinese too; issues and PRs in English or Chinese are both welcome.

Community

CONTRIBUTING ยท Roadmap ยท Code of Conduct ยท Security policy ยท Issues

License

MIT ยฉ 2026 johnnywuj81