Skip to content

feat(sleep): Antigravity harvest source + full SessionDigest evidence (re #97)#153

Open
Alphaxalchemy wants to merge 3 commits into
microsoft:mainfrom
Alphaxalchemy:feat/sleep-antigravity-harvester
Open

feat(sleep): Antigravity harvest source + full SessionDigest evidence (re #97)#153
Alphaxalchemy wants to merge 3 commits into
microsoft:mainfrom
Alphaxalchemy:feat/sleep-antigravity-harvester

Conversation

@Alphaxalchemy

@Alphaxalchemy Alphaxalchemy commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

New harvest source: Google Antigravity conversations (+ full SessionDigest in evidence)

Stacked on #151 and #152 — review only the last commit here. Proposed separately and last on purpose: this source is Windows/Google-specific and reverse-engineered, so it shouldn't gate the evidence/dashboard work — but it directly answers the direction of #97 (harvesting from more agent surfaces than Claude Code): same ask, different editor — the point is that transcript_source is pluggable, and this PR both adds a source and exercises the seam a Copilot source would use.

Why

SkillOpt-Sleep can only learn from what it can harvest. Users who do their daily work in other agentic editors have their richest transcripts outside ~/.claude. In this case the user's real corpus lives in Google Antigravity: ~/.gemini/antigravity/conversations/ — 273 SQLite "trajectory" databases, one per conversation, protobuf-encoded steps, no documented schema. The format was cracked empirically: step type 14 = user prompts, type 5 = artifact/answer content, type 33 = tool calls.

The second half of this PR closes an evidence gap the new source exposed: the harvest evidence event previously recorded only a head excerpt of each session, so the chain's very first link ("these transcripts went in") was weak. It now records the complete SessionDigest — every user prompt in full, assistant finals, tools used, files touched, feedback signals, timestamps, source — and the dashboard's Harvest section renders each as an expandable digest card. That makes the transcripts → mined-checks link in the evidence chain verifiable end-to-end, which is a prerequisite for scoring the miner against what the user actually asked.

What

  • skillopt_sleep/harvest_antigravity.py — new transcript_source: "antigravity" (config + --source):
    • schema-less protobuf string walker — no protobuf dependency, no compiled schema, so it degrades gracefully rather than breaking if Google changes field layout;
    • filters Antigravity's /goal system wrapper and read_url(...)-style tool-echo noise out of the prompt stream;
    • copies each DB before opening to dodge live-writer locks (the editor keeps the newest DB open).
  • Harvest evidence event carries the full SessionDigest; dashboard renders it (expandable per-prompt / per-final views; the old head-only format still displays for pre-upgrade nights).
  • Dashboard config grid: transcript source + max sessions/night.

Verified

Live run on the 3 most recent real Antigravity sessions: harvested 3 → DeepSeek mined 1 checkable task → reflect proposed 4 edits → gate rejected all (0.167 → 0.167, no strict improvement) in ~20s / ~7k tokens / 31 evidence events — with the recovered user prompts verbatim and clean in the digest view. Full test suite: no new failures vs pristine main.

Honest caveats

  • Reverse-engineered format, verified against current Antigravity on Windows only; the walker is deliberately tolerant, but Google can change the schema at any time.
  • Session ordering uses file mtimes; a digest with zero recoverable user prompts is skipped rather than guessed at.

* skillopt_sleep/evidence.py — append-only, thread-safe, redacted
  evidence.jsonl per night: harvest sessions -> miner exchanges (verbatim
  prompt/reply) -> mined tasks with checks -> split assignment -> every
  replay attempt (phase-tagged, cache hits marked) -> per-task scores with
  failing checks named -> reflect exchanges + parsed edits -> gate trials
  and the final decision with its score arithmetic -> staged artifacts.
  Config-gated (evidence_log, default on; evidence_max_chars cap).

* skillopt_sleep/prompts.py — central registry of the four LLM prompt
  templates (miner/attempt/judge/reflect), byte-identical defaults to the
  previously inlined strings; user overrides in prompts.json take effect
  on the next model call (mtime-checked), no restart needed.

* cycle.py builds dual backends from config (optimizer_*/target_*),
  pre-creates the staging dir so evidence lands beside the report;
  staging.new_staging_dir() de-collides same-second runs;
  latest_staging() now skips non-adoptable (evidence-only) folders.

* tests/test_sleep_evidence.py — 8 no-network stdlib tests: chain
  completeness, redaction/truncation/ordering, disable flag, prompt
  override round-trip + live effect, no-tasks-night adoption guard.
* skillopt_sleep/dashboard.py + dashboard.html — stdlib-only local web
  control panel (127.0.0.1) mirroring the pipeline flow: per-stage role/
  model/prompt display and live editing, per-night evidentiary chain
  browser (reads evidence.jsonl), gate math spelled out, config editor,
  run/dry-run launcher, and explicit adopt.

* New CLI: python -m skillopt_sleep dashboard [--port] [--no-browser].

* tests: TestDashboardApi — overview/HTML, prompt override round-trip
  via the API, unknown-night 404. Still pure-stdlib, loopback only.
…in evidence/dashboard

* harvest_antigravity.py — digests Google Antigravity trajectory DBs
  (~/.gemini/antigravity/conversations/*.db): schema-less protobuf string
  walker extracts user prompts (step_type 14), artifact finals (5) and
  tool calls (33); filters the /goal system wrapper and tool-echo noise;
  copies each DB before opening to dodge live-writer locks.
  New transcript_source value: 'antigravity' (config + --source choice).
* harvest evidence event now records the COMPLETE SessionDigest (all
  prompts/finals/tools/files/feedback), and the dashboard's Harvest
  section renders it as a full expandable digest view.
* dashboard config grid: transcript source + max sessions/night.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant