### Local Development Install of Better Plugins Source: https://github.com/johnlindquist/better-plugins/blob/main/README.md Clone the repository, navigate to the directory, add the local path as a plugin marketplace, and then install the Toolsmith plugin. ```bash git clone https://github.com/johnlindquist/better-plugins.git cd better-plugins codex plugin marketplace add "$PWD" codex plugin add toolsmith@better-plugins ``` -------------------------------- ### Install Toolsmith Plugin via Marketplace Source: https://github.com/johnlindquist/better-plugins/blob/main/README.md Add the Better Plugins marketplace and then install the Toolsmith plugin. Restart Codex after installation. ```bash codex plugin marketplace add johnlindquist/better-plugins codex plugin add toolsmith@better-plugins ``` -------------------------------- ### Gemini Video Hook Activation Example Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/gemini-video/README.md Example of how to activate the Gemini Video plugin by including the '#gemini-video' token in a prompt, followed by a command and a video path. ```text #gemini-video summarize ~/Downloads/demo.mp4 ``` -------------------------------- ### Verify Human View Plugin Functionality Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/human-view/README.md Simulates user prompts to test the Human View plugin's behavior, including opening panes, starting daemons, and updating content without reloads. This is used to verify the automated tests. ```bash export HUMAN_VIEW_DATA=/tmp/human-view-test SID=demo DIR="$HUMAN_VIEW_DATA/sessions/$SID" # 1) simulate a prompt WITH the trigger -> opens the pane + starts the daemon echo '{"hook_event_name":"UserPromptSubmit","session_id":"'$SID'","prompt":"#human Add a CLI flag parser and tests"}' \ | python3 hooks/human_view_hook.py SURFACE=$(python3 -c 'import json;print(json.load(open("'"$DIR"'/meta.json"))["surface_ref"])') cmux browser "$SURFACE" wait --load-state complete --timeout-ms 15000 cmux browser "$SURFACE" get text body # shows the task title + "Working" # 2) simulate a second prompt -> body changes WITHOUT any reload echo '{"hook_event_name":"UserPromptSubmit","session_id":"'$SID'","prompt":"Now add an error-path test"}' \ | python3 hooks/human_view_hook.py sleep 2 cmux browser "$SURFACE" get text body # changed content, no reload called ``` -------------------------------- ### User-Level Hook Configuration Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/human-view/README.md Configuration for wiring the human-view hook to Codex events in `~/.codex/config.toml`. This setup ensures the hook runs for prompt submissions, tool uses, and stop events. ```toml [hooks] UserPromptSubmit = [ { hooks = [ { type = "command", command = "python3 \"/Users/johnlindquist/codex-workshop/sdk-investigation/human-view/hooks/human_view_hook.py\"", timeout = 8, statusMessage = "Updating human view" } ] } ] PostToolUse = [ { matcher = "*", hooks = [ { type = "command", command = "python3 \"/Users/johnlindquist/codex-workshop/sdk-investigation/human-view/hooks/human_view_hook.py\"", timeout = 5 } ] } ] Stop = [ { hooks = [ { type = "command", command = "python3 \"/Users/johnlindquist/codex-workshop/sdk-investigation/human-view/hooks/human_view_hook.py\"", timeout = 5 } ] } ] ``` -------------------------------- ### Enable Plugin Hooks in Codex Configuration Source: https://github.com/johnlindquist/better-plugins/blob/main/README.md Ensure that plugin hooks are enabled in your Codex configuration file. This is a prerequisite for installing and using Better Plugins. ```toml [features] hooks = true plugins = true plugin_hooks = true ``` -------------------------------- ### Run Toolsmith Doctor and Summary Checks Source: https://github.com/johnlindquist/better-plugins/blob/main/README.md Execute the 'doctor' command for health checks and the 'summary' command to get a report over a specified number of days. ```bash python3 scripts/better_tools.py doctor python3 scripts/better_tools.py summary --days 30 ``` -------------------------------- ### Toolsmith Hook Control Output Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/toolsmith/skills/toolsmith/SKILL.md Example control-JSON objects emitted by the Toolsmith hook on stdout. These control the hook's behavior and output suppression. ```json {"continue":true,"suppressOutput":true} ``` ```json {"continue":true} ``` -------------------------------- ### Fetch and Process State Data Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/human-view/assets/index.html Periodically fetches the latest task state from the server using a GET request. It updates the UI if the revision number has changed and displays a 'reconnecting' status if the fetch fails. ```javascript async function poll() { try { const r = await fetch(`/state.json?token=${encodeURIComponent(token)}&t=${Date.now()}`, { cache: "no-store" }); if (!r.ok) throw new Error("HTTP " + r.status); const state = await r.json(); els.conn.classList.remove("bad"); els.conn.textContent = "live"; if (state.revision !== seen) { seen = state.revision; render(state); } } catch (e) { els.conn.classList.add("bad"); els.conn.textContent = "reconnecting"; } } poll(); setInterval(poll, 800); })(); ``` -------------------------------- ### Inspect Project Files Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/toolsmith/skills/toolsmith/SKILL.md Use standard shell commands to inspect the current project directory and identify relevant configuration or agent files. This helps in understanding the project's structure and dependencies. ```bash pwd ls find .. -maxdepth 2 -name AGENTS.md -o -name package.json -o -name pyproject.toml -o -name Cargo.toml ``` -------------------------------- ### Inspect Local CLI Tool Capabilities Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/toolsmith/skills/toolsmith/SKILL.md For unfamiliar CLI tools, use harmless commands like --help or --version to inspect their capabilities without executing mutating commands. This is part of the research phase before recommending tools. ```bash --help help --version ``` -------------------------------- ### Architecture Diagram Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/human-view/README.md Illustrates the flow of information and process spawning between user prompts, hooks, the daemon, and the browser view. ```text UserPromptSubmit / PostToolUse / Stop │ (stdin JSON: session_id, hook_event_name, prompt, last_assistant_message…) ▼ hooks/human_view_hook.py ← fast: mutate state.json, ensure daemon, print {"continue":true} │ spawns (detached, once) ──► daemon/human_view_daemon.py (127.0.0.1:) │ opens (once) ───────────► cmux new-pane --type browser --url http://127.0.0.1:/?token=… ▼ state.json ◄── served as /state.json ──► assets/index.html (polls every 800ms) ``` -------------------------------- ### Initialize Elements and Constants Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/human-view/assets/index.html Sets up DOM element references and defines constants for SVG shapes used in the UI. This code runs immediately when the script is loaded. ```javascript (() => { const token = "__TOKEN__"; const els = { title: document.getElementById("title"), phase: document.getElementById("phase"), detail: document.getElementById("detail"), detailCard: document.getElementById("detailCard"), prompt: document.getElementById("prompt"), summary: document.getElementById("summary"), summaryCard: document.getElementById("summaryCard"), timeline: document.getElementById("timeline"), rev: document.getElementById("rev"), updated: document.getElementById("updated"), conn: document.getElementById("conn"), glyph: document.getElementById("glyph"), }; let seen = -1; const SHAPES = { spark: '', orbit: '', stack: '', wave: '', hex: '', bolt: '', }; ``` -------------------------------- ### Configure Toolsmith Prompt and Retention Controls Source: https://github.com/johnlindquist/better-plugins/blob/main/README.md Set environment variables to control prompt text storage, excerpt length, prompt state cache TTL, and raw event retention policies. ```bash TOOLSMITH_CAPTURE_PROMPT_TEXT=0 # store prompt hashes only; disables prompt excerpts TOOLSMITH_MAX_PROMPT_EXCERPT_CHARS=800 # max prompt excerpt stored in prompt events TOOLSMITH_PROMPT_STATE_TTL_MS=21600000 # prompt-to-tool linkage cache TTL BETTER_TOOLS_RETENTION_DAYS=90 # raw JSONL retention BETTER_TOOLS_MAX_BYTES=250000000 # raw event byte cap ``` -------------------------------- ### Compile Python Scripts and Run Unit Tests Source: https://github.com/johnlindquist/better-plugins/blob/main/README.md Compile all Python files within the scripts and tests directories and then discover and run unit tests. ```bash python3 -m py_compile scripts/*.py tests/*.py python3 -m unittest discover -s tests ``` -------------------------------- ### Toolsmith Dashboard Configuration Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/toolsmith/skills/toolsmith/SKILL.md Controls the live dashboard for Toolsmith. Set TOOLSMITH_DASHBOARD=0 to disable it, or TOOLSMITH_DASHBOARD_OPEN_BROWSER=0 to run it headless. ```text TOOLSMITH_DASHBOARD=0 ``` ```text TOOLSMITH_DASHBOARD_OPEN_BROWSER=0 ``` -------------------------------- ### Run Toolsmith Analyzer Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/toolsmith/skills/toolsmith/SKILL.md Execute the Toolsmith analyzer scripts for doctor, indexing, and summarization. Ensure the PLUGIN_ROOT environment variable is set or use the full path to the script. ```bash python3 "$PLUGIN_ROOT/scripts/better_tools.py" doctor python3 "$PLUGIN_ROOT/scripts/better_tools.py" index --days 30 python3 "$PLUGIN_ROOT/scripts/better_tools.py" summary --days 30 ``` ```bash python3 /Users/johnlindquist/dev/better-plugins/plugins/toolsmith/scripts/better_tools.py summary --days 30 ``` -------------------------------- ### Gemini Video Plugin Workflow Diagram Source: https://github.com/johnlindquist/better-plugins/blob/main/plugins/gemini-video/README.md Diagram illustrating the flow of data and processes within the Gemini Video plugin, from user prompt submission to job status updates. ```text UserPromptSubmit / PostToolUse / Stop │ (stdin JSON: session_id, cwd, hook_event_name, prompt, tool_input…) ▼ hooks/gemini_video_hook.py ← fast: detect .mp4 → atomic claim → spawn detached worker → emit control JSON │ spawns (detached, once per video) ──► worker/worker.py │ └─ runs: bun ~/lessons/scripts/summarize-one.ts