Claude Code + Discord bot + Codex CLI bridge plugin — personal vault automation + multi-agent ops.
🇰🇷 한국어 버전: README.ko.md · 📘 Setup: docs/SETUP.md (developer) · 🌱 docs/SETUP-BEGINNER.md (beginner) · 🧩 docs/AGENTS.md (Custom Hybrid v1.0) · ⚙️ Config Guide (CLAUDE.md · soul.md · rules · Skills 2.0) · 🆕 Recent changes (read on install — newest-first digest the install AI should auto-reflect) · 📖 Getting started guide (English PDF) (beginner, 14p) · 📄 전체 정리 한 장 (HTML) · 🤝 ThisCodex (Codex companion)
Copy this into Claude Code or Codex:
Follow the install files in https://github.com/treylom/ThisCode step by step. Start from README.md, run the guided setup, ask me before touching credentials or system packages, and finish by running the documented verification commands.
New here? Core idea: keep a structured Obsidian vault, put the right bot in each working directory, drive them from Discord, and let the bots coordinate with each other. Shared memory / search are supporting payoffs — not the headline. Start with the Setup links above — no prior knowledge assumed.
bash install.sh boots a Claude Code + tmux environment (WSL / Linux / macOS). Core value: a structured Obsidian vault where each working directory gets an appropriate bot, all usable from Discord, with bots that can talk to each other. The 4-Tier vault search (GraphRAG → vault-search MCP → Obsidian CLI → ripgrep) + LLM model routing are the capabilities that make those bots useful — supporting, not the point.
Before you start (recommended): (1) lay out your Obsidian folder structure first; (2) install Obsidian for full memory + internal-search. No Obsidian? You can still wire a plain Discord bot for connectivity only — but vault memory and internal-search quality are not guaranteed without it.
Prerequisite: Claude Code CLI already installed + authenticated (https://claude.ai/code). The install-superpowers.sh step inside install.sh invokes the claude CLI.
For learners who prefer single-command setup (no wizard, no choices):
git clone https://github.com/treylom/ThisCode ~/.claude/plugins/thiscode
cd ~/.claude/plugins/thiscode
bash scripts/install.sh --applyThis single command installs:
- superpowers plugin (via Claude Code plugin manager)
- ripgrep (Tier 4 baseline — brew / apt / dnf / apk multi-pkg-manager fallback)
- Obsidian CLI detection (Tier 3 — manual download guide if missing)
- GraphRAG core (Tier 1 — vendored Python runtime + 7-pkg pip install)
- Dense embedding (Optional 4-channel — user confirms once, ~1GB)
After install: bash scripts/healthcheck.sh (6-phase verification: superpowers + ripgrep + obsidian-cli + vault-search MCP + GraphRAG + Dense embedding).
Windows users: WSL 2 (Ubuntu 22.04+) required. Native Windows (Cygwin / Git Bash / MSYS) is detected by install.sh and instructed to use WSL. PowerShell port is planned for a future cycle.
Dependency provenance: full attribution matrix (16 entries — Plugin 1 + Spec doc 2 + External tools 8 + Optional Dense 3 + Vendored Python runtime 1 + thiscode 1) in ATTRIBUTIONS.md. Cross-license compatibility verified by Phase 1 GPT-5.5 review (MIT + Apache 2.0 + BSD-3 + Unlicense — all permissive, copyleft zero).
Lessons learned (consolidated into the v1.0 first integrated release): This cycle's learnings are persisted in the vault under AI_Second_Brain/.claude-memory/shared/feedback_*:
feedback_no_student_term— learner / user / participant terminologyfeedback_autonomy_mode_no_option_questions— autonomous cycle asks zero option-confirmation questionsfeedback_no_turn_marker_continuous_execution— zero turn-boundary utterances, continuous executionfeedback_background_task_proactive_polling— background tasks require active polling (zero auto-notification assumption)feedback_debugging_via_codex— debugging tasks must be delegated to codexfeedback_fresh_env_actual_install_verification— Phase 1+2 static review is limited; Phase 3 actual install is required ⭐ criticalfeedback_tofu_at_codex_actual_mechanism— multi-axis parallel =/tofu-at-codex(Agent Teams + sonnet workers)feedback_sonnet_codex_debate_opus_synthesis— sonnet ↔ codex multi-round debate → opus synthesis mechanismfeedback_no_user_decision_zone_autonomous— zero "user decision zone" classification inside autonomous cycle (autonomy 3rd reinforcement)
# 1. Install thiscode as a Claude Code plugin
git clone https://github.com/treylom/ThisCode ~/.claude/plugins/thiscode
# 2. Run the wizard — auto-detects env + recommends a Phase
bash ~/.claude/plugins/thiscode/scripts/claude-discode-init.sh
# Or inside Claude Code:
/thiscode:initPlugin-marketplace path: verified working. ThisCode ships a valid
.claude-plugin/marketplace.json+plugin.json, andclaude plugin marketplace addis a real Claude Code CLI command — so the marketplace path is a supported install path, verified working end-to-end (a real WSL run via/plugin marketplace add treylom/ThisCode→/plugin install thiscode@thiscode-marketplace→/reload-pluginsloaded 5 plugins · 23 skills · 8 agents · 4 hooks):/plugin marketplace add treylom/ThisCode /plugin install thiscode@thiscode-marketplaceThe
git clone+ wizard above (or/thiscode:init) is an equally supported alternative — prefer it when you want a writable clone (e.g. for/thiscode:self-update). (Codex side: the equivalentcodex pluginpath is verified broken on codex 0.130 — different harness — see ThisCodex.)
The wizard detects your vault state / installed tools / resource limits, then recommends an 8-Phase progressive journey:
- Phase 1–2: immediate (ripgrep + obsidian-cli)
- Phase 3: 100+ notes → vault-search MCP recommended
- Phase 4: 500+ notes (recommended) / 1000+ (strongly recommended) / always optional (GraphRAG)
- Phase 5: 2000+ notes → km-at
Mode R preflight (read-only diagnostics, dry-run apply) - Phase 6–7: advanced (Dashboard / 4-channel hybrid retrieval)
GraphRAG = env-detected + opt-in (user-spec). Force install is permitted even when note count is below the heuristic threshold.
Each plugin command and skill has built-in help documentation:
Run /thiscode:help inside Claude Code to see all available commands and when to use each:
/thiscode:start— Initial setup wizard (environment detection, bot pairing, validation)/thiscode:init— Alternative lightweight setup for experienced users/thiscode:create-bot— Create a new Discord bot with soul.md template/thiscode:km— Knowledge manager with intelligent variant routing (lite/at/plain)/thiscode:search— 4-tier vault search with quick or deep modes/thiscode:open-meeting— Create meeting room structure for multi-bot collaboration/thiscode:codex-check— Validate Codex CLI bridge connectivity- And more — run
/thiscode:helpfor the complete list
Each skill (bootstrap, knowledge-manager, search, meetings, etc.) includes a "How to Use This Skill" section in its SKILL.md. These explain when to invoke each skill and what it does. Search skills are focused on vault operations; knowledge-manager skills handle content ingestion and reorganization with different feature sets (lite/at/plain/full).
Discord bot integration and tmux-based Agent Teams are opt-in extras. The 4-Tier vault search works standalone — Discord pairing is for advanced multi-bot orchestration.
Once a bot is paired, Discord becomes a remote control for your vault bots — no terminal needed:
- 💬 Hand off a task by mention —
@bot summarize today's notes; the bot works in its own session and replies in the channel. - 🧵 Hold a meeting in a thread — spin a thread for multi-bot collaboration; each bot reads/writes a shared meeting doc.
- ⏰ Wake an idle bot — a channel message re-engages a bot whose session went quiet (signal via the channel, never by injecting into its tmux — see
rules/discord-comms.md§5). - 📎 Send files & images — attach a screenshot or doc; the bot downloads it and works on it.
- 🧹 Tidy a session — a human operator can send harness session-meta commands (
/compact,/clear) straight into a bot's tmux session to manage its context (rules/discord-comms.md§5 R5).
Everyday moves. For the fuller channel-mode session model (Admin / Main / Session routing), see
docs/connector-session-ux.md.
How does thiscode's 4-Tier search trade off against vanilla obsidian-cli / /search / /vault-search? Measured on 5 axes. Measure it against your own vault — the headline numbers below are aggregates; your hardware / vault size / content distribution will shift them.
# Measure against your own vault (Tier 1 GraphRAG requires a running server)
VAULT=~/path/to/your/vault bash benchmark/runners/run-all.sh
python3 benchmark/report-generator.py --print-onlyNumbers vary widely by vault size, content, and hardware — v1.0 ships the runner and methodology rather than fixed benchmark figures. Run the script above against your own vault to get meaningful numbers.
Method / interpretation / your-own-fixture guide: docs/BENCHMARK.md. CI auto-runs Tier 4 ripgrep + sample fixture: benchmark/results/.
After retrieval, thiscode picks a model by task complexity:
| Task | Claude users | GPT / Codex users |
|---|---|---|
| Simple (factual lookup) | Haiku | gpt-5.5 |
| Medium (summary / classification) | Sonnet | gpt-5.5-codex |
| Synthesis (multi-doc reasoning) | Opus[1m] | gpt-5.5-codex-spark |
scripts/route-model.mjs heuristic — query length + keyword classifier. User override: --model haiku|sonnet|opus.
Tier order: Tier 1 GraphRAG → Tier 2 vault-search MCP → Tier 3 Obsidian CLI → Tier 4 ripgrep. Accuracy-first fallback.
📚 Lost on terms? → GLOSSARY.md
30+ terms (LLM / MCP / CEL / embedding / recall@5 / kg_depth / fallback / dispatcher / etc.).
curl -fsSL https://raw.githubusercontent.com/treylom/ThisCode/main/install.sh | bashOr git clone then run locally:
git clone https://github.com/treylom/ThisCode.git ~/code/thiscode
cd ~/code/thiscode && bash install.shinstall.sh runs 10 steps:
| Step | Action | Dependency |
|---|---|---|
| 1 | OS / Distro detect (WSL / Linux / macOS) | uname |
| 2 | Base packages (tmux + git + curl + jq + build-essential) | apt / dnf / yum / brew / pacman |
| 3 | nvm + Node.js LTS | curl |
| 4 | Claude Code global install | npm |
| 4.5 | Codex CLI (@openai/codex) global install — bridge dependency |
npm |
| 5 | oh-my-tmux (gpakosz/.tmux) auto install |
git |
| 6 | (optional) thiscode tmux.conf.local apply |
user confirm |
| 6.5 | Obsidian CLI (Mac brew cask / WSL Windows native / Linux snap·flatpak·deb) — Tier 3 fallback | brew / snap / manual |
| 7 | Claude Code plugin install guidance (marketplace + slash commands) | (slash inside Claude Code) |
| 8 | First bot wizard guidance (/thiscode:start) |
(slash inside Claude Code) |
Plugin slash commands auto-detected after install:
/thiscode:init— onboarding wizard (env detect + 8-Phase recommend)/thiscode:start— main wizard (env detect + bot setup + first conversation)/thiscode:install-hooks— SessionStart + UserPromptSubmit + Stop (active-meeting reread) hook safe-merge into~/.claude/settings.json(SessionStart injects soul.md + memory +rules/INDEX.md; the Stop hook is how recent rule/meeting changes auto-apply — see docs/RECENT-CHANGES.md)/thiscode:create-bot— new bot directory + .env + soul.md template/thiscode:add-bot— add one additional bot/thiscode:open-meeting— create a meeting folder (multi-bot 4-file standard)/thiscode:codex-check— Codex CLI bridge verification/thiscode:self-update— self-update check (git fetch behind)
Pristine Claude Code bootstrap (no hooks, no bots yet):
1. /thiscode:install-hooks # Register SessionStart + UserPromptSubmit + Stop (meeting reread) hooks
2. /thiscode:create-bot # First bot directory + soul.md setup
3. /thiscode:start # Main wizard (Discord pairing + first conversation)
4. /thiscode:codex-check # Verify Codex CLI active (optional)
thiscode bundles the author's vault operations playbook:
- 03-shared-memory.md — 4-tier shared memory (T1 git-tracked / T2 machine-specific / T3 project-meetings / T4 per-bot WD)
- memory-dreaming.md — reversible memory archival (plain-language): periodic, move-not-delete cleanup that ships idle memory to out-of-WD cold storage with one-command checksum-verified restore. One tier-agnostic rubric across all tiers incl. Codex; conservative (auto-archive gated, ambiguous → human review); criteria self-correct from restores. Tool:
scripts/memory_dreaming.py(--scandefault dry-run /--applygated /--restore/--recalibrate), weekly-enforced (YAML manifest + session-start overdue check + launchd) - orchestrator-watchdog (
scripts/meeting_watchdog.py) — meeting progress watchdog (recommended on every meeting — invite one watchdog bot per meeting, start before the first dispatch): on meeting-thread creation a YAML-enforced watchdog checks progress every ~5 min and self-terminates only when the goal AND all tasks complete (models Claude Code/goal).start/beat/check/status/stop; fail-closed = keep-active (never falsely terminate a live meeting); pairs with 05-meeting-thread-protocol.md §2.3 + rules/meeting-protocol.md §5 - 04-obsidian-cli.md — Obsidian CLI setup (Mac brew / WSL Windows native / Linux snap·flatpak·deb) + 3-Tier fallback (CLI → MCP → Write/Read/Grep) + known bugs / workarounds
- 05-meeting-thread-protocol.md — meeting thread & channel governance (new topic = new thread / archive final deliverables only / cross-machine = multiverse)
- 06-claude-code-server.md — Claude Code server modes (
claude -pheadless + MCP server + tmux session vs headless split pattern) - 08-debug-노하우.md — 24+ debugging categories (Workflow / Code Review / Vault Path / Meeting protocol / Security / Time / LLM Prompt / Schedule / Plugins / External Apps / Cross-bot SoP) — Korean only, dense operational learnings
claude auth login # 🐧 👤 → browser-based authenticationtmux new-session -s claude # 🐧 👤
cd ~/<project> && claude # 🐧 🤖Inside Claude Code:
/thiscode:start # 🤖 wizard entry
The wizard walks you through Discord bot creation (Developer Portal), token entry, persona selection (soul.md template), and pairing + first conversation verification.
| Icon | Meaning |
|---|---|
| 🖥️ | Windows PowerShell |
| 🐧 | WSL Ubuntu / Linux terminal |
| 🤖 | Claude Code executes automatically |
| 👤 | User types directly |
| ✅ | Success |
| ❌→✅ | Failure followed by recovery |
thiscode/
├── install.sh # Env auto-detect + 10-step automation
├── README.md # This file (English, default)
├── README.ko.md # Korean version
├── LICENSE # MIT
├── .claude-plugin/
│ ├── marketplace.json # thiscode-marketplace
│ └── plugin.json
├── commands/ # Slash commands (incl. /thiscode:init)
├── skills/
8BD0
# skill dirs (vault-mirror policy)
│ ├── knowledge-manager/ # full vault 7-Layer Fusion (1161 lines)
│ ├── knowledge-manager-at/ # Agent Teams variant (1189 lines)
│ ├── knowledge-manager-lite/ # Lite single-agent (530 lines)
│ ├── knowledge-manager-bootstrap/ # 4-Tier install bundle
│ ├── knowledge-manager-plain/ # headless variant
│ ├── search/ # 4-Tier vault search
│ ├── search-lite/ # 3-Tier (no GraphRAG)
│ ├── codex-exec-bridge/ # vault skill mirror (folder)
│ ├── init/ # onboarding wizard skill
│ ├── bootstrap/ # plugin install wizard
│ ├── meetings/ # 4-file meeting protocol
│ └── shared-memory/ # 4-tier memory policy
├── hooks/ # Bot operations hooks
├── templates/ # 5 soul.md personas
├── configs/ # tmux.conf.local
├── benchmark/ # 4-Tier benchmark (run-all.sh + fixtures)
├── contracts/ # search-fallback-4tier.md
├── schemas/ # agent-spec.json (Custom Hybrid v1.0)
├── scripts/ # install-graphrag.sh / install-obsidian-cli.sh / route-model.mjs
└── docs/ # SETUP / SETUP-BEGINNER / AGENTS / GLOSSARY / BENCHMARK / ARCHITECTURE / MANUAL
Fresh WSL Ubuntu or macOS, setting up Claude Code for the first time.
curl -fsSL https://raw.githubusercontent.com/treylom/ThisCode/main/install.sh | bashPair a Discord bot with a custom persona — Write soul.md, create the bot, run /thiscode:start.
Follow the wizard. The 8-Phase journey takes you from ripgrep-only to GraphRAG-with-Mode-R-preflight at your own pace.
| Environment | Support | Notes |
|---|---|---|
| WSL Ubuntu 20.04+ | ✅ primary | install.sh most-tested target |
| Linux native (Debian / Ubuntu / Fedora / Arch) | ✅ | Package manager auto-detected |
| macOS | ✅ | brew-based |
| Windows native | ❌ | Use WSL instead |
| Agent runtime | Compatibility | Notes |
|---|---|---|
| Claude Code | ✅ primary target | Anthropic official CLI |
| Hermes Agent (NousResearch) | 🟡 partial | SKILL.md is portable; Hermes wrapper deferred |
| Codex CLI / Cursor / Gemini CLI / Goose | 🟡 SKILL.md only | agentskills.io standard adopted |
source ~/.bashrc may not work in all shells. Close the terminal fully and open a new one.
chmod +x install.sh
./install.shOr just bash install.sh.
You already ran claude inside a tmux session. Use Ctrl+B → c to open a new window (the ain helper handles this automatically).
Remote has new commits:
git pull --rebase
git pushDM the bot again → it issues a fresh code.
If your bot's responses don't reflect the persona, the SessionStart hook is likely not registered:
/thiscode:install-hooks
This safely merges the bot-session-init.sh hook into ~/.claude/settings.json while preserving any existing hooks.
bash scripts/install-graphrag.sh --check # python3 + vendor SoT + requirements + venv + server health
bash scripts/install-graphrag.sh --preflight # Python 3.10+ / disk 5GB+ / port 8400 / vendor SoT check
bash scripts/install-graphrag.sh --apply # venv setup + pip install + nohup uvicornThe --apply mode:
- venv location =
~/.cache/thiscode/graphrag/venv(writable home cache) - vendor SoT =
<thiscode>/vendor/graphrag/scripts/(equivalent snapshot of vault SoT, 21 files) - requirements =
vendor/graphrag/scripts/requirements.txt(7 deps: networkx / louvain / pyyaml / fastapi / uvicorn / numpy / httpx) - entry =
uvicorn search_server:app --host 127.0.0.1 --port 8400(background nohup) - log =
~/.cache/thiscode/graphrag/run/graphrag.log
bot-session-init.sh(SessionStart) — auto-detects bot viaDISCORD_STATE_DIRenv var → injects soul.md + per-bot WD memory + common disciplinediscord-slash-cmd.sh(UserPromptSubmit) — if user prompt's first line is/cmd, forces Skill tool invocationregression-self-check.sh(UserPromptSubmit) — injects a 4-gate self-check table to refresh attention against regression patterns
init— onboarding wizard (env detect + 8-Phase recommend)bootstrap— installer wizard helpershared-memory— 4-tier memory policy + Read-before-Editmeetings— 4-file meeting protocol + source-backed cross-check + Discord REST API threadscodex-exec-bridge— Codex CLI subprocess +/tofu-at-codexreferenceknowledge-manager-at— km-at Mode R preflight (read-only diagnostics + dry-run apply)
thiscode includes Codex CLI as a first-class bridge layer:
codex --versionandcodex exec --no-stream --model gpt-5.5as subprocess- Use cases: adversarial review, second-opinion code review, large-scale parallel research
- Verified via
/thiscode:codex-check
schemas/agent-spec.json defines a per-agent contract registry combining agentskills.io base + Hermes provides_* + thiscode classroom policy + dynamic gates + benchmark integration. v1.0 adds tier: core (init wizard) and phases: for km-at Mode R preflight workflow.
This repo distills the author's (treylom) vault operations experience.
- PRs and issues welcome
- Debugging know-how contributions welcome
- Course learner feedback welcome
MIT — free to use / modify / redistribute. Details: LICENSE
- gpakosz/.tmux (oh-my-tmux): https://github.com/gpakosz/.tmux
- agentskills.io (SKILL.md open standard): https://agentskills.io
- Anthropic Claude Code: https://www.anthropic.com/claude-code
- NousResearch/hermes-agent: https://github.com/NousResearch/hermes-agent
- OpenAI Codex CLI: https://github.com/openai/codex
🇰🇷 Korean version: README.ko.md