Skip to content

Merge test branch to main#337

Merged
plind-junior merged 41 commits into
mainfrom
test
Jul 2, 2026
Merged

Merge test branch to main#337
plind-junior merged 41 commits into
mainfrom
test

Conversation

@plind-junior

@plind-junior plind-junior commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What changed

Why

What might break

VEP

Tests

  • make check passes locally (lint + mypy + pytest)
  • New / changed behaviour has a test
  • CHANGELOG.md updated under ## [Unreleased]

Summary by CodeRabbit

  • New Features

    • Added automatic session capture and recall for Claude Code sessions, including review-gated summaries and next-session context injection.
    • Introduced theme detection and theme proposal support for finding recurring topics across sessions.
    • Added new CLI commands and setup options to manage capture, recall, and theme workflows.
  • Bug Fixes

    • Improved handling of non-UTF-8 environments by standardizing text decoding.
    • Made bulk listing more resilient so unreadable items are skipped instead of breaking results.

plind-junior and others added 30 commits June 30, 2026 13:51
the examples/ fixtures gained rendered screenshots in #290 but the
top-level readme never pointed at them. add a one-line nudge from the
30-second tour so a reader can see what the cli returns before installing.
render.py resolved `vouch` off PATH first, so a stale global install
shadowing the venv would render every shot against the wrong build and
silently overwrite the committed images. prefer the vouch next to the
running interpreter (the venv's editable build); fall back to PATH only
when none exists. the guard test now passes without activating the venv.
docs(examples): surface screenshots in readme, harden render resolution
add docs/tutorials/ — an index plus four diátaxis walkthroughs (build your
first knowledge base, give a coding agent a reviewed memory, share a kb via
bundles, edit a kb in obsidian). every command was run end-to-end against
the cli before it went in, so the walkthroughs only cover verified
behaviour (including the real forbidden_self_approval review gate).

feature the native one-line wire-up `claude mcp add vouch -- vouch serve`
in getting-started step 6, and add a "how a host talks to vouch" section to
docs/transports.md describing the stdio mcp path end to end — spawn,
handshake, tool call, review gate, _meta sidebars, server-to-client push.

fix the read-sidebar guidance in claude.md: the per-tool read sidebar is
_meta.vouch_salience (salience.py, attached by kb_context), not
vouch_hot_memory — that key is written only by the openclaw context
engine's assemble().
docs: add tutorials, host-comms walkthrough, one-line mcp install
`vouch pending` — and every bulk `list_*` path — crashed with a yaml
ReaderError when a single proposal file held a control character: one
unreadable file took down the whole listing. add a `_load_or_skip` helper
that logs a warning and skips the bad file instead of aborting, applied
across proposals, claims, entities, relations, evidence, sessions, sources.

the control character traces back to vouch's own file i/o relying on the
locale default encoding: on a non-utf-8 locale (e.g. latin-1) read_text /
write_text / open mangle non-ascii into raw bytes the yaml loader rejects,
and can even crash on write. pin encoding="utf-8" on all text-mode pathlib
i/o under src/vouch.

adds regression tests for the resilient listing.
fix(storage): survive unreadable artifact files and pin utf-8 i/o
update package version across pyproject.toml, src/vouch/__init__.py,
openclaw.plugin.json, and SPEC.md examples to reflect 1.0.0 stable release.
feat: claude code session auto-capture + approved-knowledge recall
design: automatic finalization of old buffers on sessionstart,
and current session on window close.

plan: 8-task breakdown covering capture.py functions, cli command,
adapter hooks, comprehensive unit tests, integration test, and
documentation.
implement is_stale_buffer() to check file age, and finalize_all_except()
to bulk-finalize capture buffers older than a threshold. this enables
sessionstart cleanup of orphaned buffers from previous sessions.

includes 9 unit tests covering single/multiple buffers, age boundaries,
and current session exclusion.
new command finalizes all capture buffers except the given session,
if they are older than max_age_seconds (default 3600s). silently
succeeds if no kb found. used by sessionstart hook to clean up
orphaned buffers from previous sessions.

includes 3 unit tests covering option parsing, env fallback, and
graceful degradation.
run 'vouch capture finalize-all' as the first sessionstart hook
to clean up orphaned buffers from previous sessions before
banner and recall commands. ensures old sessions are finalized
automatically on next session start.
add comment to sessionstart hook explaining that current session
finalization happens on next session start (fallback behavior when
windowclose event is not supported by the vs code extension).
add section describing how capture works, configuration options,
and the fallback behavior if windowclose event is not available.
plind-junior and others added 11 commits July 1, 2026 18:50
verify that old buffers are cleaned up on new session start
and current session is finalized on window close (or manual finalize),
resulting in two separate proposals.
…rigin

when finalize_all_except() cleans up orphaned buffers, those old sessions
have unknown origin (no cwd), so we should not attribute the current
working directory's git diff to them. this prevents data corruption where
old sessions' summaries get current repo changes, and avoids spurious
proposals that cross min_observations due to misattributed file counts.

added explicit cwd check: if cwd is None (unknown origin), skip git
changes. normal finalize calls with explicit cwd still get git context.

also fix typo: unfinalzed -> unfinalized in adapter README.
feat(capture): automatic session finalization on sessionstart and close
adds kb.detect_themes (read-only cluster detector) and kb.propose_theme
(routes synthesis pages through the review gate). scoring is deterministic
— entity pair co-occurrence across sessions, weighted by log(1 + claim_count).

registered on all four surfaces (mcp, jsonl, cli, capabilities). the cli
exposes `vouch detect-themes` with --propose for one-shot propose-all.

adds THEME to the PageType enum so theme pages pass the page-kind gate.
deduplication prevents re-proposing clusters that already have pending or
approved theme pages.

closes #311
…utput

- config reader now type-checks every value and falls back to defaults
  on malformed input (mirrors salience.reflex_cfg pattern)
- dedup in detect_themes now compares on the resolvable entity subset
  so it stays consistent with what propose_theme actually stores
- --propose --json no longer interleaves human-readable lines on stdout
- adds changelog entry under [unreleased]
feat(themes): cross-session pattern detection via entity co-occurrence
the benchmark suite was implemented but unrunnable out of the box:
pytest-benchmark wasn't in the [dev] extras, and the bench_*.py
filenames don't match pytest's default python_files glob, so the
documented invocation collected zero tests.

- add pytest-benchmark to the [dev] optional-dependencies
- add a `make bench` target that folds in the python_files override
- record the first baseline (medians at 1k/10k) in benchmarks/README.md
  and flip its status from "not implemented yet" to implemented
- gitignore the bench.json / .benchmarks run artifacts
chore(bench): wire make bench, add pytest-benchmark, record baseline
lead the readme with session auto-capture — the feature that stops each
new agent session from re-doing the last one's work.

- banner.svg: add a "sessions capture themselves" on-ramp that funnels
  into the review gate; swap the approve/reject text labels for icons;
  refresh the example date and kb panel; add a self-capturing pill.
- gittensor.md + readme gittensor section: reframe from "cited record of
  the subnet's scoring rules" to a real miner workflow — capture what a
  session learns about a target repo, approve it, recall it next session
  so the investigation happens once. grounded in the real sn74 loop
  (merged prs, repo allocation, a shuffling whitelist).
- demo.gif/tape + example-session.md: the auto-capture walkthrough.
- .claude/settings.json + commands: reference capture hooks and the four
  vouch slash commands. settings.local.json intentionally omitted.
…miner

docs: redraw hero banner + reframe gittensor around the miner workflow
Copilot AI review requested due to automatic review settings July 2, 2026 06:33
@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance cli command line interface auto-pr auto-pr orchestration review-ui browser review ui adapters agent host adapters and install manifests openclaw openclaw integration mcp mcp, jsonl, and http surfaces storage kb storage, migrations, schemas, and proposals retrieval context, search, synthesis, and evaluation embeddings embedding-backed retrieval sync sync, vault mirror, and diff flows packaging packaging, build metadata, and make targets tests tests and fixtures size: XL 1000 or more changed non-doc lines labels Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 11db9ba1-d96d-4fbb-ae58-be374f83b338

📥 Commits

Reviewing files that changed from the base of the PR and between 94e84b1 and 0278fc6.

⛔ Files ignored due to path filters (2)
  • docs/banner.svg is excluded by !**/*.svg
  • docs/demo.gif is excluded by !**/*.gif
📒 Files selected for processing (72)
  • .claude/commands/vouch-propose-from-pr.md
  • .claude/commands/vouch-recall.md
  • .claude/commands/vouch-resolve-issue.md
  • .claude/commands/vouch-status.md
  • .claude/settings.json
  • .gitignore
  • CHANGELOG.md
  • CLAUDE.md
  • Makefile
  • README.md
  • SPEC.md
  • adapters/claude-code/.claude/settings.json
  • adapters/claude-code/README.md
  • adapters/claude-code/install.yaml
  • benchmarks/README.md
  • docs/demo.tape
  • docs/example-session.md
  • docs/getting-started.md
  • docs/gittensor.md
  • docs/img/examples/render.py
  • docs/superpowers/plans/2026-07-01-vouch-session-autocapture.md
  • docs/superpowers/plans/2026-07-01-vscode-session-autoproposal.md
  • docs/superpowers/specs/2026-07-01-vouch-session-autocapture-design.md
  • docs/superpowers/specs/2026-07-01-vscode-session-autoproposal-design.md
  • docs/transports.md
  • docs/tutorials/README.md
  • docs/tutorials/connect-coding-agent.md
  • docs/tutorials/edit-in-obsidian.md
  • docs/tutorials/first-knowledge-base.md
  • docs/tutorials/share-a-knowledge-base.md
  • openclaw.plugin.json
  • pyproject.toml
  • scripts/smoke-capture.sh
  • scripts/smoke-recall.sh
  • src/vouch/__init__.py
  • src/vouch/__main__.py
  • src/vouch/auto_pr.py
  • src/vouch/capabilities.py
  • src/vouch/capture.py
  • src/vouch/cli.py
  • src/vouch/context.py
  • src/vouch/embeddings/scorer.py
  • src/vouch/embeddings/similarity.py
  • src/vouch/health.py
  • src/vouch/http_server.py
  • src/vouch/index_db.py
  • src/vouch/install_adapter.py
  • src/vouch/jsonl_server.py
  • src/vouch/migrations/_legacy.py
  • src/vouch/migrations/journal.py
  • src/vouch/migrations/manifest.py
  • src/vouch/migrations/runner.py
  • src/vouch/migrations/schema.py
  • src/vouch/models.py
  • src/vouch/openclaw/context_engine.py
  • src/vouch/page_kinds.py
  • src/vouch/pr_cache.py
  • src/vouch/proposals.py
  • src/vouch/recall.py
  • src/vouch/scoping.py
  • src/vouch/server.py
  • src/vouch/stats.py
  • src/vouch/storage.py
  • src/vouch/sync.py
  • src/vouch/themes.py
  • src/vouch/volunteer_context.py
  • src/vouch/web/server.py
  • tests/test_capture.py
  • tests/test_install_adapter.py
  • tests/test_recall.py
  • tests/test_storage.py
  • tests/test_themes.py

📝 Walkthrough

Walkthrough

This PR adds automatic Claude Code session capture (observe/finalize/recall) with a review gate, cross-session theme detection/proposal, JSON-merge install support for adapter settings, UTF-8 encoding hardening across config/artifact I/O, resilient bulk listing that skips corrupt files, benchmarking infrastructure, version bumps to 1.0.0, and extensive new documentation/tutorials.

Changes

Session Auto-Capture & Recall

Layer / File(s) Summary
Capture core module
src/vouch/capture.py, src/vouch/storage.py, src/vouch/__main__.py
New capture module buffers tool observations, dedups, summarizes git diffs, finalizes into a PENDING session-summary proposal, and detects/finalizes stale buffers; storage starter config gains capture/recall sections; adds python -m vouch entrypoint.
Recall digest module
src/vouch/recall.py
Builds a session-start digest of approved claims and page titles, with size-bounded truncation.
CLI wiring
src/vouch/cli.py
Adds capture observe/finalize/finalize-all/banner commands and a non-fatal KB lookup used by recall.
Adapter hooks & install
.claude/settings.json, adapters/claude-code/.claude/settings.json, adapters/claude-code/install.yaml, adapters/claude-code/README.md
Configures SessionStart/PostToolUse/SessionEnd hooks to run capture/recall commands and documents the tier T4 install behavior.
Tests
tests/test_capture.py, tests/test_recall.py
Covers config loading, dedup, finalize/finalize-all, CLI commands, and digest generation/truncation.
Smoke scripts
scripts/smoke-capture.sh, scripts/smoke-recall.sh
End-to-end shell tests validating capture, finalize, review gate, and recall behavior.
Design docs
docs/superpowers/plans/..., docs/superpowers/specs/...
New plan/spec markdown documenting the autocapture and VS Code auto-proposal architecture.
Demo & example walkthroughs
docs/demo.tape, docs/example-session.md
Rewrites demo tape and example session to show hook-driven capture, finalize, approval, and recall.
Narrative docs
README.md, docs/getting-started.md, docs/gittensor.md, docs/transports.md, CLAUDE.md, CHANGELOG.md
Documents the capture/recall loop and MCP wiring throughout the project docs.

Cross-Session Theme Detection

Layer / File(s) Summary
Theme detection/proposal module
src/vouch/themes.py
Detects entity co-occurrence clusters across sessions and files a review-gated theme page proposal.
API wiring
src/vouch/models.py, src/vouch/capabilities.py, src/vouch/server.py, src/vouch/jsonl_server.py, src/vouch/cli.py
Adds PageType.THEME, kb.detect_themes/kb.propose_theme capabilities, MCP/JSONL handlers, and vouch detect-themes CLI.
Tests
tests/test_themes.py
Verifies detection thresholds, read-only behavior, dedup, and proposal validation.

Claude Adapter JSON-Merge Install

Layer / File(s) Summary
Implementation
src/vouch/install_adapter.py, src/vouch/cli.py
Adds json_merge install mode merging permissions/hooks into existing .claude/settings.json without clobbering user content.
Tests
tests/test_install_adapter.py
Verifies merge, idempotency, and malformed/non-object JSON handling.

UTF-8 Encoding Hardening & Storage Resilience

Layer / File(s) Summary
Storage resilience
src/vouch/storage.py, tests/test_storage.py
Adds _load_or_skip used across list_* methods so corrupt YAML is skipped, and standardizes UTF-8 encoding on writes/reads.
Config/artifact reader UTF-8 fixes
src/vouch/* (many modules), CHANGELOG.md
Numerous modules now decode config/YAML/JSON files with explicit UTF-8 encoding.

Benchmarking Infrastructure

Layer / File(s) Summary
Bench target and docs
Makefile, benchmarks/README.md, pyproject.toml, .gitignore
Adds make bench, pytest-benchmark dependency, updated docs, and ignores for bench artifacts.

Documentation, Version Bumps, and Claude Commands

Layer / File(s) Summary
Version bumps
pyproject.toml, src/vouch/__init__.py, openclaw.plugin.json, SPEC.md
Bumps version to 1.0.0 across manifests.
Claude commands
.claude/commands/*.md
Adds new slash-command specs for propose-from-pr, recall, resolve-issue, and status.
Tutorials
docs/tutorials/*
New tutorials index and four end-to-end tutorial documents.
Render script fix
docs/img/examples/render.py
Prefers interpreter-local vouch binary before PATH fallback.

Estimated code review effort: 5 (Critical) | ~150 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Hook as ClaudeHook
  participant CLI as vouch_cli
  participant Capture as capture_module
  participant Store as KBStore
  Hook->>CLI: capture observe (tool payload)
  CLI->>Capture: observe(session_id, tool, summary)
  Capture->>Store: append JSONL buffer
  Hook->>CLI: capture finalize (SessionEnd)
  CLI->>Capture: finalize(session_id, cwd)
  Capture->>Capture: build_summary_body()
  Capture->>Store: propose_page() PENDING
  Capture->>Store: delete buffer
  Hook->>CLI: recall (SessionStart)
  CLI->>Store: build_digest()
  Store-->>Hook: approved claims/pages digest
Loading
sequenceDiagram
  participant Client
  participant Server as MCP_Server
  participant Themes as themes_module
  participant Store as KBStore
  Client->>Server: kb_detect_themes()
  Server->>Themes: detect_themes(store)
  Themes-->>Server: DetectResult clusters
  Client->>Server: kb_propose_theme(cluster)
  Server->>Themes: propose_theme(store, cluster)
  Themes->>Store: propose_page() PENDING
  Themes-->>Server: proposal_id
Loading

Possibly related issues

Possibly related PRs

  • vouchdev/vouch#303: Wires the same Claude Code session-lifecycle hooks to vouch capture/vouch recall and the install-mcp JSON-merge behavior.
  • vouchdev/vouch#304: Adds/extends the same capture.is_stale_buffer()/finalize_all_except() and vouch capture finalize-all flow.
  • vouchdev/vouch#240: Touches the same src/vouch/volunteer_context.py module extended in this PR.

Suggested labels: enhancement

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@plind-junior plind-junior merged commit b671bf1 into main Jul 2, 2026
10 of 11 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR, despite its minimal title ("Merge test branch to main") and empty description template, is a large feature drop that adds three major runtime capabilities to vouch and performs a 0.0.1 → 1.0.0 version bump. It introduces auto-capture of Claude Code sessions (capture.py + hooks), a session-start recall digest (recall.py), and cross-session theme detection (themes.py) exposed as two new kb.* methods (kb.detect_themes, kb.propose_theme) plus a new built-in PageType.THEME. It also sweeps encoding="utf-8" across text I/O, adds _load_or_skip resilience to bulk storage listings, and teaches the install adapter to deep-merge .claude/settings.json.

Note: the AGENTS.md hard rules state that surface changes (new kb.* methods, on-disk layout like .vouch/captures/, new page kinds) require an accepted VEP, and no matching proposal appears in proposals/. Combined with the empty PR description and the major version jump, the change set warrants human review before merge.

Changes:

  • New features: session auto-capture, session-start recall digest, and cross-session theme detection with two new kb.* methods, CLI commands, config namespaces, and Claude Code hook wiring.
  • Robustness/consistency: UTF-8 encoding pinned across text I/O, _load_or_skip for unreadable YAML in bulk listings, and idempotent JSON merge for adapter settings.
  • Release metadata: version bumped to 1.0.0 across __init__.py, pyproject.toml, SPEC.md, openclaw.plugin.json, plus README/tutorial/CHANGELOG updates.

Reviewed changes

Copilot reviewed 71 out of 74 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/vouch/capture.py New auto-capture module; config read at line 44 misses encoding="utf-8".
src/vouch/recall.py New recall-digest module; correctly pins UTF-8 (reference for the convention).
src/vouch/themes.py New theme-detection module; config read at line 65 misses encoding="utf-8".
src/vouch/cli.py Adds capture/recall/detect-themes commands; mangled comment at 3008 and a --json stdout leak at 1992-1994.
src/vouch/server.py Registers kb_detect_themes / kb_propose_theme MCP tools.
src/vouch/jsonl_server.py Adds theme JSONL handlers; lacks envelope-shape tests for the new methods.
src/vouch/capabilities.py Appends the two new theme methods to METHODS.
src/vouch/storage.py Adds _load_or_skip resilience, capture starter config, and gitignore for captures.
src/vouch/install_adapter.py Adds idempotent json_merge for .claude/settings.json.
src/vouch/models.py Adds PageType.THEME built-in page kind.
src/vouch/init.py Version bump to 1.0.0, contradicting README's "pre-1.0 alpha" note.
pyproject.toml / SPEC.md / openclaw.plugin.json Version metadata bumped to 1.0.0; adds pytest-benchmark.
adapters/claude-code/* Wires capture/recall/finalize hooks into settings; manifest marks settings for merge.
Makefile / benchmarks/* / scripts/* Adds bench, smoke-capture, smoke-recall targets and supporting scripts.
tests/test_capture.py, tests/test_recall.py, tests/test_themes.py, tests/test_install_adapter.py, tests/test_storage.py New/updated tests for the added behavior (theme JSONL/MCP/CLI surface untested).
README.md / docs / CHANGELOG.md Documentation and changelog updates for the new features.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/vouch/cli.py
if open_browser and is_loopback:
# Lazy-import webbrowser; some CI envs (headless) don't have a default
# browser configured and webbrowser.open() returns False rather than
# browser configured and webbrowser.open(encoding="utf-8") returns False rather than
Comment thread src/vouch/capture.py
def load_config(store: KBStore) -> CaptureConfig:
"""Read ``capture:`` from config.yaml; fall back to defaults."""
try:
loaded = yaml.safe_load(store.config_path.read_text())
Comment thread src/vouch/themes.py
and falls back to its default rather than crashing on malformed input.
"""
try:
raw = yaml.safe_load(store.config_path.read_text())
Comment thread src/vouch/__init__.py
"""vouch — git-native, review-gated knowledge base for LLM agents."""

__version__ = "0.0.1"
__version__ = "1.0.0"
Comment thread src/vouch/jsonl_server.py
Comment on lines +731 to +732
"kb.detect_themes": _h_detect_themes,
"kb.propose_theme": _h_propose_theme,
Comment thread src/vouch/cli.py
Comment on lines +1992 to +1994
if not result.clusters:
click.echo("no themes detected")
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adapters agent host adapters and install manifests auto-pr auto-pr orchestration cli command line interface docs documentation, specs, examples, and repo guidance embeddings embedding-backed retrieval mcp mcp, jsonl, and http surfaces openclaw openclaw integration packaging packaging, build metadata, and make targets retrieval context, search, synthesis, and evaluation review-ui browser review ui size: XL 1000 or more changed non-doc lines storage kb storage, migrations, schemas, and proposals sync sync, vault mirror, and diff flows tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants