feat(parser): add aider session parser - #740
Conversation
aider stores per-repo chat history as Markdown at <repo>/.aider.chat.history.md, accumulating multiple "# aider chat started at" runs per file. Add a parser that splits a history file into one session per run (via the existing virtual-path fan-out used by Shelley and Zed), parsing the #### user prompts, assistant prose, and > tool/edit lines. Discovery is a bounded, time-budgeted rootless walk under a configurable root (default $HOME, AIDER_DIR to override); the agent uses a shallow file watch so it does not recursively watch the whole home directory. Session IDs derive from the history-file path, the run header timestamp, and an ordinal among same-header runs, so appends and different-header edits never re-key existing sessions. processFile resolves the aider virtual path for stat so a single session re-syncs through the live watcher.
roborev: Combined Review (
|
Addresses automated review feedback: - The stored "<historyFile>#<idx>" path is positional, so a single-session re-sync could parse the wrong run after an earlier run was inserted or removed. The source-path lookup now validates that the stored index still recomputes to the requested raw ID (AiderRawIDAt) and otherwise re-resolves by raw ID via FindAiderSourceFile. - The discovery depth cap was off by one: a directory exactly aiderMaxWalkDepth levels under the root was skipped before its history files were visited. Skip only below the cap so the documented N-level scan reaches files at the maximum depth.
roborev: Combined Review (
|
Addresses roborev review findings: - splitAiderRuns accumulated each run body via repeated string concatenation (quadratic on large history files); build the body with strings.Builder and materialize once per run. - processAider skipped via the physical history-file path, but aider sessions are stored under virtual "<history>#<idx>" paths, so the generic lookup never matched and an unchanged history was re-parsed/re-hashed/re-written on every sync. Add aiderFileUnchanged, which checks the per-run virtual paths' stored mtime at the current data version (mirroring kiroSQLitePendingSessionIDs).
roborev: Combined Review (
|
Addresses roborev review findings: - Remote SSH sync tarred the entire home directory because aider's default dir resolves to $HOME. The resolve script now emits aider only when AIDER_DIR is explicitly set (and rejects AIDER_DIR=$HOME), so an unscoped aider agent no longer tars the remote home. Local discovery is unchanged. - Aider session IDs hashed the on-disk path, a random temp dir during SSH extraction, so the same remote run got a new ID each sync. Thread a canonical identity path (the rewritten remote path) into the ID hash; local sync (no rewriter) is byte-for-byte unchanged. - aiderFileUnchanged skipped a file when ANY run row was current; it now skips only when every content-bearing run row is current (HasMessages marks which runs produce sessions), so a partial write no longer strands the rest.
roborev: Combined Review (
|
Addresses roborev review findings: - gate aiderFileUnchanged behind !forceParse so a forced parse-diff reparses already-synced aider files instead of skipping them. - handle aider <history>#<idx> virtual paths in stripVirtualSourceSuffix so parse-diff maps run rows back to the physical history file. - compare stored file_size alongside mtime/data-version in aiderFileUnchanged, so a same-mtime append/truncate is re-parsed instead of skipped.
roborev: Combined Review (
|
|
working on this now |
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
Summary
Adds an
aidersession parser. aider stores per-repo chat history as Markdown at<repo>/.aider.chat.history.md, where each file accumulates multiple# aider chat started at ...runs.What it does
<historyFile>#<runIdx>) already used by the Shelley and Zed parsers, so a physical file maps to multiple sessions rather than one flattened blob.####user prompts, assistant prose, and>tool/edit lines. aider has no tool role in agentsview, so tool/edit lines surface as assistant transcript content (the> Applied edit to ...lines are preserved verbatim), mirroring the gptme parser.$HOME, override viaAIDER_DIR/aider_dirs— with a skip-set and a depth cap. The agent uses a shallow file watch so it does not recursively watch the whole home directory; new runs are picked up by the periodic sync.Identity and limitations
Where to look
internal/parser/aider.go(parser + discovery),internal/sync/engine.go(processAiderfan-out and the virtual-path stat resolution that lets a single session re-sync via the live watcher),internal/parser/types.go(registry entry, shallow watch).