Commit Graph

205 Commits

Author SHA1 Message Date
felixm d95aed0111 Add AntiDrift favicon 2026-06-01 19:09:37 -04:00
felixm 895ad342c7 Migrate the reflection fetch onto runFetchAsync
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 18:12:10 -04:00
felixm 59283be733 Migrate the coach fetch onto runFetchAsync
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 18:08:48 -04:00
felixm fbbff6966d Migrate the knowledge fetch onto runFetchAsync
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 18:06:09 -04:00
felixm db0d11ea2e Add runFetchAsync helper and migrate the tasks fetch
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 18:05:08 -04:00
felixm d3f0526355 Split async AI roles into roles.go
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 17:57:26 -04:00
felixm 0d3294b30d Split drift/nudge/enforcement into drift.go
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 17:50:53 -04:00
felixm d068e2f79c Split evidence-stats accounting into stats.go
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 17:46:15 -04:00
felixm a0f144968b Split session views into views.go
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 17:42:53 -04:00
felixm f13f33cf74 Add knowledge stale-discard characterization test
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 17:39:40 -04:00
felixm 465938906e Add M9 tame-session refactor implementation plan
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 17:31:57 -04:00
felixm 79b3c0be95 Add M9 tame-session refactor design spec
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 17:24:36 -04:00
felixm 5adab985a7 Add the enforce toggle and drift-band minimize note
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 12:49:31 -04:00
felixm 4cc1edfc60 Wire the enforce guard into the daemon and assert it on the wire
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 12:46:59 -04:00
felixm 47f1167247 Minimize the off-task window on confirmed drift at the block level
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 12:43:30 -04:00
felixm 41c0a5fbbc Thread per-commitment enforcement level through to the snapshot
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 12:41:09 -04:00
felixm 7fdcae5d14 Add enforce.Guard port with X11 and no-op adapters
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 12:35:54 -04:00
felixm d0e6893659 Add M8 Tier A window-minimize enforcement implementation plan
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 12:22:59 -04:00
felixm 76cdd4c857 Add M8 Tier A window-minimize enforcement design spec
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 12:11:56 -04:00
felixm e3cfe8c70c Assert the reviewer fires exactly once per session
Closes the one coverage gap from the final review: the spec's
'one async call per session' efficiency claim is now directly
verified via the reviewer call count, not just implied. Also drops a
stale CarryForward-preview mention from the Review projection in the
design spec to match the shipped (cleaner) behaviour.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 09:47:27 -04:00
felixm 95e14e6340 Show the recap on Review and the carry-forward on Planning
The Review screen renders the reviewer's one-line recap (quiet pending
line, then the recap); the Planning screen renders last session's
carry-forward as a 'Last time: …' one-liner, mirroring the knowledge
indicator. Updates the README Status section for M7.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 09:42:21 -04:00
felixm ff100b2472 Wire the reviewer and assert reflection on the wire
main injects the AI service as the reviewer alongside the other roles.
A web test drives a session to Review and asserts the recap rides the
state payload, then to the next Planning and asserts the carry-forward
does too.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 09:38:13 -04:00
felixm a4f0c00cac Reflect on entering Review and ground the next coach
The controller fetches a reflection asynchronously on enterReview
(generation-guarded, non-blocking, graceful) and caches a one-line
recap plus a latest-wins carry-forward. The recap projects onto Review,
the carry-forward onto the next Planning, and both ride the snapshot.
RequestCoach composes the carry-forward into the coach's existing
free-form grounding string, so ai.Coach is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 09:36:50 -04:00
felixm 25f56b3c71 Add RecentSessions reader over the audit chain
Exposes the last n session summaries (oldest-first) for the reviewer to
read as recent-history context. Missing/empty chain or n<=0 yields nil.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 09:26:57 -04:00
felixm e4e34b092c Add reviewer role to the ai port
A fourth leaf role: Review(finished, history) returns a two-line
Reflection (recap + carry_forward) over the same CLI backend as the
coach. Primitive-only, with a JSON prompt and a tolerant parser that
rejects a blank recap but allows an empty carry_forward.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 09:24:04 -04:00
felixm 82fd7d35a5 Add M7 reflection implementation plan
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 09:20:55 -04:00
felixm f417faab9a Add M7 reflection design spec 2026-06-01 09:11:00 -04:00
felixm 5342da2755 Show a profile-grounding indicator on the planning screen
The planning view renders a quiet line for the standing-profile state
(loading/grounded/absent/unreadable) with a "change" affordance to
repoint the file via POST /knowledge/path. The profile text never
reaches the browser — only status, path, and size. Also updates the
README Status section to describe the M6 knowledge port.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 08:08:55 -04:00
felixm b1b807590c Wire the knowledge file adapter and a runtime path selector
main constructs the FileSource (default via ANTIDRIFT_KNOWLEDGE_FILE)
and injects it. Adds POST /knowledge/path to repoint the profile file at
runtime, and web tests asserting the planning payload carries the
knowledge object (status + path, never the text) and that path selection
reloads.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 08:06:10 -04:00
felixm 8bd37ed46d Load the knowledge profile on planning and ground the coach
The controller loads the profile asynchronously on entering planning,
mirroring the tasks fetch: generation-guarded goroutine, status enum
(idle/pending/ready/absent/error), projected into State only while
planning and only when a source is set. The loaded text is cached and
passed to the coach as grounding; SetKnowledgePath repoints the file at
runtime. nil source degrades to no view and an ungrounded coach.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 08:04:13 -04:00
felixm 0f1790c8d5 Thread optional grounding into the coach prompt
The ai.Coach interface gains a grounding parameter carrying standing
context about the user (the knowledge port). buildPrompt injects an
"About the user" block only when grounding is non-empty, so an empty
grounding produces a byte-for-byte unchanged prompt. Drift judge and
nudge are untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 08:01:03 -04:00
felixm 09061f8e30 Add knowledge port and single-file adapter
The knowledge.Source port answers "who am I; what are my priorities?".
The FileSource adapter reads one profile file (path selectable per call),
treats a missing/blank file as absent (not an error), and caps the text.
Leaf package mirroring tasks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 07:59:48 -04:00
felixm 9e03add01b Add M6 knowledge-port design spec and implementation plan
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 07:58:55 -04:00
felixm 9452e54867 Add M5 tasks-port implementation plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 22:11:59 -04:00
felixm 8b5121c69d Show today's tasks as seed chips on the planning screen
The planning view renders Marvin's today list as clickable chips;
clicking one fills the intent field, feeding the existing coach flow.
idle/error/empty render nothing, pending shows a quiet loading line.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 22:09:38 -04:00
felixm e832a2da85 Wire Marvin tasks adapter into the daemon
main constructs the Marvin adapter (command overridable via
ANTIDRIFT_MARVIN_CMD) and injects it. Adds a web test asserting the
planning state payload carries today's tasks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 22:07:20 -04:00
felixm c4eb870808 Test that a stale tasks fetch result is discarded
Exercises the generation/left-planning guard in startTasksFetchLocked
via the fakeProvider gate: a fetch in flight when its generation is
superseded must not clobber the current tasks state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 22:06:04 -04:00
felixm 8b7bec1173 Fetch today's tasks asynchronously on entering planning
The controller fetches the Marvin task list when entering planning,
mirroring the planning coach: generation-guarded goroutine, status enum
(idle/pending/ready/error), projected into State only while planning and
only when a provider is set. nil provider degrades to no tasks view.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 22:02:28 -04:00
felixm 569264be11 Add tasks port and Amazing Marvin adapter
The tasks.Provider port answers "what should I be doing?". The Marvin
adapter shells out to ampy's `am --json` and parses today's open tasks,
dropping done/empty-title entries. Leaf package mirroring ai.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 21:59:00 -04:00
felixm 267eda59e6 Add M5 tasks-port design spec
Design for the tasks.Provider port: an Amazing Marvin adapter shelling
out to `am --json`, today's tasks seeding the planning intent field.
Read-only, no writeback, graceful degradation — mirrors the ai port.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 21:50:15 -04:00
felixm 6b2a96620c M4: drop stale plan-task reference from CSS comment
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 21:16:11 -04:00
felixm 51cb09c520 M4: presentational review recap
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 21:13:04 -04:00
felixm f5da12362a M4: cockpit HUD with state-driven accent
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 21:10:03 -04:00
felixm 76816ae188 M4: split web UI assets into app.css and app.js
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 21:05:34 -04:00
felixm 93e779348c M4: add look-good implementation plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 21:03:34 -04:00
felixm c807a72623 Spec M4: cockpit-style web UI design pass
State-driven accent HUD, stacked bands, CSS/JS split out of the inline
HTML, polished presentational review recap. No behavior changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 20:57:32 -04:00
felixm 097678e839 Mirror runtime status to ~/.antidrift_status
A window-manager status bar can now read a single-line status file: a
glyph plus minutes-remaining (● 24m / ⚠ DRIFT 24m / ● 24m ·? / ◔ planning
/ ✓ review), empty when idle. Rewritten on a one-minute tick, only when
the line changes, and removed on shutdown. Degrades to no file if $HOME
is unresolvable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 20:49:48 -04:00
felixm 19654c2b57 Align M3.5 design doc with the nudgeEpoch guard
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 18:52:01 -04:00
felixm 622a1cd401 Tie nudge validity to the on-task stretch
A soft nudge advisory belongs to one continuous on-task stretch in an allowed
app. Guard it with an on-task-stretch epoch (advanced on session reset and on
any non-on-task-match observation) instead of a session-only counter, and clear
the advisory on leaving the allowed app, so a stale 'Heads up' never resurfaces
after a drift episode.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 18:20:22 -04:00
felixm 9dd0bb934e Wire the semantic nudge into the daemon and document M3.5
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 18:11:42 -04:00