Repository navigation
Add 'basou refresh --watch' to keep the corpus current - #45
Merged
Merged
Conversation
Import is a pull, so the corpus only advances when 'basou refresh' runs.
After multi-root capture fixed which repos are scanned, the remaining gap
is currency: with no scheduler, the dogfood corpus drifts stale the moment
more AI work happens. --watch closes that gap.
'basou refresh --watch [--interval <seconds>]' runs a catch-up refresh on
start, then polls the native-log stores (~/.codex/sessions,
~/.claude/projects) and re-imports + regenerates only when they have
SETTLED (unchanged since the previous poll, so nothing is captured
mid-write) AND changed since the last import. Handoff / decisions
regenerate only when something was actually imported, so AI work in
unrelated projects never rewrites this workspace's files. Polling is
dependency-free and cross-platform; latency is the interval (default 30s,
min 5s, max 1 day), not real-time. Ctrl-C / SIGTERM stops after the
in-flight cycle, never mid-write.
Design (v1): per-file {mtime,size} scan for settle + change detection;
the baseline scan is taken before the initial import so a session that
appears during the import window is never mistaken for "already seen" and
missed; a pending-regenerate flag retries regeneration if an import
succeeded but the regenerate failed; scan errors are surfaced pathlessly
and a root that is missing or not a directory contributes nothing; the
abortable sleep leaves no listener behind across polls. Because import is
idempotent, a session still active at start-up or one that resumes after
it settled is recorded only up to that point -- 'basou refresh --force'
rebuilds those. Event-driven watching and vendor session hooks are
deferred.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 tasks done
takashi-matsuyama
added a commit
that referenced
this pull request
Jun 8, 2026
Promote the Unreleased changelog to 0.7.0 and bump @basou/core, @basou/cli, @basou/sdk, and the bare `basou` installer to 0.7.0 in lockstep. Publishes two dogfood-proven features already on main plus two folded-in fixes. Features since 0.6.0: - Multi-root capture: one .basou/ workspace can aggregate the native logs of several sibling repositories (#44). - `basou refresh --watch`: keep the workspace current automatically by polling the native-log stores and re-importing only settled, changed sessions (#45). Fixes: - Reject --session combined with --all on import (both adapters). - Drop a reference to a nonexistent `basou session export` from the session-import JSON Schema. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
basou refresh --watch [--interval <seconds>]so a workspace stays currentwithout re-running
basou refreshby hand. Import is a pull, so the corpus onlyadvances when refresh runs; with no scheduler, it drifts stale. After multi-root
capture (#44) fixed which repos are scanned, this closes the currency half.
Behaviour
(
~/.codex/sessions,~/.claude/projects) everyintervalseconds (default30, min 5, max 86400).
(unchanged since the previous poll, so nothing is captured mid-write) and
changed since the last import.
AI work in unrelated projects never rewrites this workspace's files.
real-time. Ctrl-C / SIGTERM stops after the in-flight cycle.
--watchrejects--dry-run,--json, and--force.Design (v1) and known limits
{mtime, size}scan drives both settle and change detection.appears during the import window is never mistaken for "already seen" and
missed.
regenerate failed (handoff / decisions can't be left stale forever).
contract); a root that is missing or not a directory contributes nothing.
long run).
resumes after it settled is recorded only up to that point;
basou refresh --forcerebuilds those. Event-driven watching (fs.watch / chokidar) andvendor session hooks are deferred.
Testing
pnpm -r build && pnpm typecheck && pnpm test && pnpm lintgreen(core 743, sdk 17, cli 441; lint 0 errors).
scanSourceLogs/scansEqual(collection, missing root, afile-as-root
ENOTDIR, growth); the watch loop (settle — asserting ajust-appeared log is NOT imported before it stabilises; no regeneration when a
change imports nothing relevant; clean abort);
parseIntervalrangevalidation; and
--watch+--dry-run/--json/--forcerejection.Out of scope
Event-driven watching, vendor
SessionEndhooks, git hooks, per-source-roottagging, and re-import of resumed sessions (the
--forcepath covers the last).