Omniscio

AI Coaching sidebar (interview prompts and artifacts) (part 3)

Part 3 of the AI Coaching sidebar page: the free-form coaching sessions, the compaction summaries and durable memory facts behind the coach, the synthesized Core Profile, the Life Inventory surfaces, and the telemetry that proves the memory system works.

On this page

What it is

This is part 3 of the AI Coaching sidebar (interview prompts and artifacts) page. It covers what the coach remembers and what can be read back out of it — free-form (non-interview) coaching sessions, the conversation compaction and durable memory facts behind them, the synthesized Core Profile, the two Life Inventory surfaces, and the validation telemetry the memory system emits.

Where to find it

AI Coaching is the virtual project in the left sidebar, and the parent page covers turning it on and working the Dashboard. Within it the Core Profile has its own pane, the Memory Explorer sits in the AI Coaching sidebar section and the Life Inventory panes sit alongside them; the rest of this part describes work you never click — summaries, extracted facts and cost caps that happen in the background.

How it behaves

Free-form (non-interview) coaching sessions

Not every session in the AI Coaching project is a structured interview. If you open a generic session there — a plain "+ New", or a CLI / deep-link spawn (anything whose session source is NOT prefixed ai-coaching:) — the coach still gets your current context: a short Core Profile summary plus the artifact index (every artifact as a one-line gist + per-level token costs, pulled on demand), the same lean pull menu an interview uses, but with no interview scaffolding (no fixed script, no opening-message template, no "produce an artifact" closing). It's a free-form coaching conversation. Because it has no artifact to save, the coach never promises you a saved write-up there; when you want one, it offers the matching structured interview instead.

That context is built fresh from your live artifacts at spawn (buildFreshCoachingContext, which composes with buildCoachingBaseContext) and written into the session's OWN room, ~/amc-ai-coaching/sessions/<sessionId>/CLAUDE.md, right before the CLI launches — so a free-form session can never read a stale CLAUDE.md an earlier interview left behind, and no second start can replace the file another session is reading. The write is gated in session-create-spawn-tail.ts to fire ONLY for the AI Coaching project AND a non-ai-coaching: source (isCoachingFeatureSource is the gate), so it can never clobber a structured interview's own richer file. It is fail-open (a context-write failure never blocks the spawn). Every room is private to one session, so two starts in the same instant write two different files. buildFreshCoachingContext is the ONE builder: it loads artifacts, Core Profile, bookmarks, memories, recent journal entries, goal trends and cross-artifact insights, so the + New free-form door carries the same layers as every other door. It also ends with the same short Life Inventory summary block an interview gets (buildLifeInventoryPointerForCoaching, with the same gates: AI Coaching on, the data belongs to the signed-in account, the personal space open, and a finished take whose detail file exists), so the start-screen notice that a summary goes with every coaching session holds for free-form chats too. Locked by ai-coaching-free-form-life-inventory.test.ts. Locked by ai-coaching-base-context-write.test.ts + coaching-session-rooms.test.ts.

Conversation compaction (segment summaries)

Long coaching interviews are divided into segments. Each interview's plan sets how many minutes of conversation a segment lasts, and the clock counts conversation time only: it starts at the coach's first reply, and neither a break nor time the app was closed counts. The clock adds up the time between one coach reply and the next, but a gap counts for at most 10 minutes (IDLE_GAP_LIMIT_MS in markers.ts) — enough to read and type a long answer — so stepping away from an open interview without pressing pause does not move it forward. The time-left warning still measures from the clock start, so an idle gap does count toward that. Quick check-ins have no segments. The first time the conversation crosses a pause point, the break prompt appears and a background process summarizes the conversation so far into a compact summary; a pause point never runs twice, even after a restart. The prompt withdraws once the session can no longer be paused — paused, shutting down or archived — and the resume line is the one that applies there. This summary is stored and, when you resume the session later, injected into the CLAUDE.md as a ## Conversation So Far section. Claude reads this summary to understand the conversation history without needing the full transcript in its context window.

The summary is generated by a Haiku call (fast, low-cost) and capped at 1,024 tokens. The input is the newest part of the conversation that fits in 60,000 characters, so a later pause summarizes where the conversation left off, not its opening. A short Anthropic outage — an overloaded or failing server, or a connection that could not be made — is retried up to three times by the segment pipeline. Anything else (no API key, the day's budget spent, a rate limit, a timeout) is logged and the session continues without a summary. It never blocks or crashes the segment pause flow. A rate limit or a timeout is never resent: the limit has not lifted yet, and a request that timed out after it was sent may already have been billed.

Cost for compaction calls is tracked under the label ai-coaching-compaction in the API cost log. Compaction summaries share a $0.25 daily sub-cap (COMPACTION_SUB_CAP_CENTS) with the condensed versions of saved write-ups, inside the $0.35 session pool. Condensing stops at 60% of that sub-cap (LEVELS_YIELD_THRESHOLD), so catch-up work always leaves the rest of the day for live summaries. The cap check fails open on DB errors so a transient issue never silently blocks summaries. The API key fallback chain is: your active API key account → your first API key account → graceful failure.

Learned facts (one learning step)

When a sitting ends, AI Coaching learns from it once, after the compaction step. An interview's sitting ends at the pause point its segment clock reaches. Any chat also ends a sitting when it goes quiet: the coach has answered, 10 minutes have passed, and the person said something new since it last learned. That is how a free chat, a check-in or Go deeper ends, and how an interview learns what was said after its last pause point. A pause point records what it learned, so going quiet at that break learns nothing twice. It then learns from the whole chat with no break prompt, and learns again only after the person says more. The Journal will use the same step when an entry is finished. It is the only way facts are learned: saving a write-up no longer learns anything, and the old conversation, write-up and write-up goal extractors are gone.

What the step sends and keeps:

  • The person's own words only. The person's turns are sent inside <user> tags and the coach's turns inside <coach> tags as context. Look-alike <user>/<coach> tags are stripped from every turn first, so no one can close their own turn and speak as the other.
  • A fact must quote the person. Each fact carries the sentence it came from, and it is kept only when that sentence really is in the person's words (case, spacing and quote marks set aside). A coach suggestion, or a sentence nobody said, is dropped.
  • No secrets. A fact that names a password, PIN, key, token or card or security number is never saved, whoever asked for it.
  • At most five facts per sitting or entry, the most important first.
  • Already known. Up to 100 recent facts are sent, numbered, so the step can say a new fact replaces an older one. A fact that repeats a live one confirms it (its confirmed date moves) instead of being saved twice.

What it writes, all in one go:

  • Each fact with its source: the chat and segment (or the Journal entry), the sentence it came from, and what it replaced.
  • A replaced fact leaves memory but is kept as history: it is not listed in Recently deleted, the 30-day sweep never erases it, and the newer fact links to it. A fact the person added by hand is never replaced.
  • A learned goal also goes on the goals list, unless a goal with that title is already there or in Recently deleted.
  • Nothing is saved when the chat or entry was deleted while the AI was answering, or when the signed-in account changed.

It runs on the person's own AI service through the cost door — their Claude subscription by default, or their own Anthropic key — never Omniscio's allowance. With neither, or with the day's memory budget spent, it skips and sends nothing. A short outage is retried up to three times; any other failure is logged by the chat and segment (or entry) id, never the person's words. Two failed sittings in a row for one chat raise one card, which clears the next time a sitting learns.

A restated fact is confirmed, and the chat or entry that restated it is remembered too. When a Journal entry is deleted, only the facts no other live entry or chat still teaches go to Recently deleted with it, and Undo brings back exactly those. A fact the person removed is never learned again. The Journal reads an entry's facts with listJournalEntryFacts (each with the text of the fact it replaced) and removes one with trashJournalEntryFact, which works with AI Coaching switched off.

Cost is tracked under the label ai-coaching-memory in the API cost log, inside the session pool.

Surfacing memories in coaching prompts

Extracted memories are injected into every coaching session's CLAUDE.md as a #### Personal Context section, placed between Core Profile and Key Moments (bookmarks). Each build loads listMemoriesForContext(db) (memory.ts): live high/medium-confidence memories, by category then newest, capped at 1,000. formatMemoriesForContext() (context-sections.ts) drops any whose meaningful words are 85%+ present in the core profile, groups survivors under category headings, and adds them in order until its budget share (at most MEMORY_BUDGET_MAX, 2,000 chars) is full, skipping any that no longer fit. With no survivors the section is omitted — no empty heading.

The memory block is included in baselineChars so it counts against the total 120K CLAUDE.md budget. Four call sites load it — three in ai-coaching-service.ts (deferred interview, immediate interview, refresh) via tryListMemories, one in ai-coaching-base-context.ts (free-form) — and all are fail-open: a listMemoriesForContext error is logged and the session proceeds without memories. Per-path telemetry fields are in the table below.

Implementation: extract-facts.ts (the learning step), learned-facts.ts (how learned facts are written), fact-sources.ts (where a fact came from, the Journal entry reads and deletes), memory.ts (queries: insertMemoryFacts, listMemoryFacts, softDeleteMemoryFact), migration 20260730184927-ai-coaching-conversation-memory-table.ts. Tests: extract-facts.test.ts and ai-coaching-learned-facts.test.ts (the step) + memory fact tests in queries-ai-coaching.test.ts.

Profile page (replaces Memory Explorer and Core Profile)

The Profile page shows every fact Omniscio holds, grouped under the 8 foundation topics, under the person's own In my own words text. There is no separate Memory Explorer any more: the same facts are listed, searched, edited, confirmed and removed here.

  • Reads one view (ai-coaching:get-profile-view): In my own words, the 8 topics in fixed order with the summary that is still current for each, and the facts not yet filed under a topic. A summary is shown only while its fingerprint matches the topic's profile facts.
  • Edits reuse the memory channels: ai-coaching:update-memory (an edit also marks the fact edited, so learning never replaces it, and confirms it), ai-coaching:delete-memory (to Recently deleted, with an Undo toast that calls ai-coaching:restore-deleted) and ai-coaching:create-memory (Add a fact, filed under the topic it was added in). Still true is ai-coaching:confirm-fact, and In my own words saves through ai-coaching:save-own-words with the stamp it was opened from; an out-of-date save is refused.
  • Every change goes through one owner, announceFactsChanged in profile/profile-lifecycle.ts, which rebuilds the profile before the call returns and pushes ai-coaching:core-profile-changed; the page reloads on that push and on ai-coaching:memories-changed.

Implementation: ProfilePane.tsx, profile-lifecycle.ts, queries in profile-facts.ts.

Cross-artifact insight injection

Earlier versions of the coaching engine compared write-ups and stored cross-artifact insights (contradictions and evolutions) in the ai_coaching_insights table. That generation and its Refresh button are retired: the mentor loop's invitations replace them. A saved insight keeps working exactly as described here until you dismiss it. These insights are injected into every coaching session's CLAUDE.md as a #### Cross-Artifact Insights section, positioned between the journal block and the goals block.

At prompt-build time, formatInsightsForContext() in ai-coaching-claudemd-builder.ts loads insights via listActiveInsights(db), which returns only the latest insight (the one the dashboard shows and lets you dismiss) and nothing once that one is dismissed, so an older insight you can no longer see or dismiss never reaches the coach (dt:F043). It renders each insight's content.summary as a bullet with its artifact-pair label (e.g. *(Career History ↔ Core Values)*). An insight stores the two write-ups' artifact IDS, so both builders pass their artifact list and the label is resolved to the write-ups' titles; when either id no longer names a saved write-up, the label is left off rather than printing a raw id (Q-631 L2-F01). It greedy-packs the bullets — an entry that would overflow is skipped, never truncated — within within a INSIGHT_BUDGET_MAX (2,000-character) budget. When no insights exist or none fit the budget, the section is omitted entirely — no empty heading.

A dismissal sticks to the two write-ups it compared. When saveInsight in insights.ts stores a new insight, it looks for an earlier insight the person dismissed for the same two write-ups, in either order, and if it finds one the new insight is saved already dismissed. The match is on the pair being saved, never on the most recently dismissed pair, so dismissing a different pair later does not bring this one back (F011). Either order matches because generation lists the most recently saved write-up first, so saving a new version of the other one flips the order of the same two (dt:F044).

The latest insight is the newest non-deleted row by creation time whose two compared write-ups are both still live, read across the whole local coaching corpus rather than filtered by the API key's Anthropic account, so an insight saved before an API-key change still shows on the dashboard and still reaches the coach afterwards (jrn:F036). This follows the ai-coaching contract's corpus-is-account-owned rule: the corpus has one owner and its key is never the Anthropic credential. Each row still records the account id that generated it, and per-account version numbers restart with a new key, which is why ordering is by creation time first. The read includes a dismissed row, so the dashboard decides visibility from dismissedAt. An insight that compares a write-up in Recently deleted is skipped, so neither the dashboard nor the coach sees it and the newest insight over two live write-ups shows instead; restoring the write-up brings it back, and it stays hidden once the write-up is erased for good (the Recently deleted contract's deleted-means-gone-from-view rule). The dashboard and the coach show that insight only when the signed-in Omniscio user may read the coaching corpus (localDataBelongsToCurrentAccount, the same owner check the Tasks brief and session auto-context use), so after a sign-in switch to a different Omniscio account the previous owner's insight is never shown; the dashboard answers none_generated instead. The export and the dismissed-pair carry-forward are still scoped to the current key's account.

Loading still requires a resolved API key (resolveApiKeyForAiFeatures()). The dashboard does not: it shows the saved insight with or without a key, and answers no_credential only when no key is set and nothing is saved (Q-1132). If no key is available or the query fails, insights are silently skipped — the session proceeds without them (empty array fallback, same fail-open pattern as memories and goals). Telemetry fields insightCount and insightChars are emitted with every memory_context_built event.

The insight block is included in baselineChars so it counts against the total 120K CLAUDE.md budget. Both call sites wire it: the interview path via buildAICoachingClaudeMd() and the free-form path via buildCoachingBaseContext() / writeCoachingBaseContext().

A dismissal and the coaching export belong to the coaching data owner, not to the API key. The dismissed-pair lookup in saveInsight matches an earlier dismissal saved under ANY API key, so a pair dismissed before a key change stays dismissed after it. Each row still records the account id of the key that generated it, and its version number counts per account. The export reads listAllInsights(db), which returns every live insight in the corpus, newest first by creation time, and nothing at all when localDataBelongsToCurrentAccount says the signed-in Omniscio user does not own the coaching corpus (Q-587).

Implementation: insights.ts (listActiveInsights query), ai-coaching-claudemd-builder.ts (formatInsightsForContext, INSIGHT_BUDGET_MAX), ai-coaching-base-context.ts (loadInsights, used by free-form sessions and by loadInterviewContext in service.ts for interviews). Tests: insight integration tests in ai-coaching-claudemd-builder.test.ts and ai-coaching-interview-insights.test.ts.

Core profile (synthesized context)

The profile is built from facts, with no AI call: the facts Omniscio has learned are placed under the 8 foundation topics (at most five per topic, the most important first), each topic carries a short summary while that summary still matches its facts, and the person's own In my own words text is pinned first. The AI never rewrites In my own words. Every fact change (a learned fact, an edit, a removal, a restore, a saved write-up or a privacy change) rebuilds the profile before it returns, so the next conversation already reads it. There is no Regenerate and nothing to cancel (profile-lifecycle.ts).

When the core profile exists, it's injected at the very top of the ## What You Already Know section in every coaching session's CLAUDE.md — before any individual artifact blocks. This gives Claude a cohesive understanding of who you are before diving into per-artifact details. Its ~1,200 characters reduce the budget available for individual artifacts by that amount.

The profile is loaded in full unless the whole file overruns its total budget (TOTAL_CLAUDEMD_BUDGET, 120,000 characters): the journal, memories and bookmarks are dropped first, in that order, and only if the file is still too long is the profile cut. It then loses its tail by the overage plus TRUNCATION_SAFETY_MARGIN (20 characters), possibly mid-sentence, and ends in a ...(truncated) line; a profile no more than TRUNCATION_SAFETY_MARGIN longer than the overage is dropped whole instead, with no ...(truncated) line, and is still recorded as the coreProfile stage; a profile shorter than the overage is left whole and the file stays over. When any of these stages ran, the file also ends with a [context-trimmed: …] line naming them (for example [context-trimmed: journal, memories, bookmarks, coreProfile]); the coach reads both markers. You see nothing in the app: the trim is logged as a warning, and an interview's memory_context_built event records the stages as trimStages. Implementation: trimToFitBudget in context-budget.ts.

Cost for profile generation is tracked under the label ai-coaching-profile in the API cost log and has its own $0.15/day pool, separate from the session pool that pays for conversation compaction and artifact summaries.

Editing In my own words from the CLI

PUT /ai-coaching/core-profile (an approval card) and the ai-coaching:update-core-profile channel write In my own words, through the same function as the Profile page. Send baseSavedAt, the saved-at of the copy the edit started from: when another save landed since, the edit is refused as out of date and nothing is written (Q-1069), and an approved agent edit is reported as not started with that reason. An edit that names no base replaces the saved text. GET /ai-coaching/core-profile reads the built profile (isStale is always false).

The daily spending limit card

When any coaching pool reaches its daily limit, an inbox card says so: "AI Coaching has reached a daily spending limit and is temporarily using simpler fallbacks until the limit resets at midnight." Without it, coaching would just get simpler with no explanation.

  • When the limit resets: at local midnight, the same boundary every daily spend total uses. The card names no amounts and no pool, and it tells the person to do nothing, because it clears itself.
  • One card per pool: each pool keeps its own card, keyed ai-coaching-daily-cost-cap:<pool>:<YYYY-MM-DDTHH>. The hour in the key is UTC, so repeat hits from one pool within an hour become one card instead of a burst.
  • When it clears: the next passing limit check clears every card for that pool, whichever hour it was raised in. The clear goes through the family clear door, which also records the clear on cards a person already put away, so those can't hold back the next card.
  • After midnight: the check-in scanner clears any card created before local midnight, at startup and on every 5-minute tick. It clears only those cards, so a card raised today stays. This runs even with the Daily Journal off, but not while the scanner service is paused, and after a wake it can take up to 5 minutes. A card whose creation time can't be read is left alone.

Implementation: cost-cap-alerts.ts and checkin-scanner.ts.

Sharing the AI fairly with the rest of the app

Coaching's background work never makes Writer AI or Mind Map AI wait. Each coaching budget has its own lock — condensing and summaries share one, memory and goal extraction share another, insights and Quick Check-in prompts have their own — and none of them is the account-wide lock Writer and Mind Map take. A background call takes its budget's lock before it takes one of coaching's three simultaneous-call slots, so a call that is only waiting never ties up a slot a Refresh Insights click needs.

  • Condensing a saved write-up generates only the versions still missing for that exact content: one already done, or deliberately skipped because it would not have come out shorter, is never paid for again. It holds its lock for one call at a time, and it stops after a rate limit, an overload, a timeout or an open outage switch instead of trying the remaining versions. Only one condensing run per saved version is ever in flight: a second request for the same version — the start-up catch-up meeting a fresh save — joins the run already going instead of paying for the same versions again. A run whose wait for its lock times out still saves the versions it already bought, and the rest are made at the next start.
  • The start-up catch-up waits three seconds after each write-up that needed calls, and stops when Anthropic pushes back; the next start or the next save picks up the rest.
  • A reply cut off at its length limit is trimmed to its last complete line and kept. One with no complete line left — a one-line gist or a single key point cut off mid-word — is not kept, and that version is made again at the next start. A version the model refuses to write is not retried, since it would refuse again.
  • A conversation summary cut off at its length limit, or refused, is not saved. A resumed interview then uses the last complete summary, or a context rebuilt from the person's write-ups, goals and memories, instead of continuing from half a summary.
  • A short Anthropic outage while condensing raises the "summary generation failed" card (after one automatic retry) with a plain sentence saying the versions will be made again at the next start. The full write-up is always saved.
  • Goal extraction and profile refresh failures raise their own cards. The goals card says goals are read again the next time the write-up is saved. A goal or memory extraction that was skipped or failed is also tried again at the next launch, within the same cap: each saved version stays marked as owing it until the AI has replied. The profile card says to open Profile in AI Coaching and choose Regenerate, and its Profile button opens that pane.
  • Goal extraction checks the outage switch inside its lock, right before the call, and cancels its request at 30 seconds instead of holding the connection for two minutes.
  • Every coaching call that is actually sent is counted in the app's shared AI-call health numbers (anthropic_call events tagged with the coaching cost label), and a call that timed out after it was sent is counted as a possible charge.

For agents — the rules behind the list above, in generation.ts, haiku-call.ts and cost-cap.ts:

  • One run per version. generateArtifactLevels coalesces callers on ${artifactId}@${version} with no hang ceiling. A re-read inside the lock could not replace it: a run writes all its levels once, after its last lock window, so another run would still see them pending.
  • Levels reserve nothing (F017). Their gate reads committed spend only, because a reservation is queued work, not spend; the spending-limit card is raised only when committed spend passes the cap.
  • The client is built before any lock (F002), so no caller on the same budget waits behind an SDK import.
  • A 400 is not push-back (F053). It ends that one level; any other thrown failure stops the run.
  • Retry-safe failures (F018) are a 5xx/529 or a connection that never opened (a connect-phase errno, looked for at most four .cause hops down — the SDK error wraps fetch failed, which wraps the errno). Timeouts and rate limits are never resent: a request that timed out after it was sent may already be billed.
  • Only a sent request reports (F013). A failed client build or an open outage switch sends nothing and records no telemetry. The snack prompt's outage-switch charge stays unconditional (F072), because it also releases a half-open probe claimed before a failed client build.
  • Key Points stay under 400 words (F073) so they fit the 1,024-token reply cap.
  • The Core Profile takes no budget lock. Its two calls write up to 2,048 tokens each, so each gets 50 seconds, and both still finish inside the 120-second Regenerate deadline; its own in-flight guard keeps it to one run at a time.
  • Goal extraction asks for at most 1,024 tokens (the goals JSON array), and its 30-second limit is also the client's own socket timeout. Artifact memories have no backfill, which is why a short outage on that path is handed back to the memory batch.
  • The start-up catch-up still refreshes the Core Profile after it stops early.
  • Lazy imports keep the translator (the condensed-versions error sentence) and the alert stack out of these modules' import graphs, so the specs that load them need no Electron.

When Anthropic retires the background model

Every background job on this page — compaction summaries, memories, insights, the condensed artifact levels, the Core Profile, goal extraction and snack prompts — runs on a fast Claude Haiku model, today Claude Haiku 5.5. Coaching switches off Haiku 5.5's built-in thinking for these jobs (goal extraction excepted), because that thinking would use up the short reply length each job is sized for. Anthropic retires older models over time. If the model in use stops being offered, the first call that finds out moves to the next Haiku model coaching knows about, every later call in that app run goes straight there, and the cost is recorded at that model's price. A retired model is not treated as an Anthropic outage, so it never pauses the other AI features. When no listed model is left, one inbox card explains that the background features have stopped; coaching conversations themselves are not affected.

Memory usage instructions

The shared coaching context block (getSharedContext()) — injected into every coaching session's CLAUDE.md — contains a <memory_usage> section that teaches Claude how to use the memory infrastructure described above. It covers:

  • Context Layers — explains all seven blocks the coach receives, in the order they arrive: Core Profile, Personal Context from conversation memories, Cross-Artifact Insights, Goal Progress Trends, Key Moments/bookmarks, Pinned Context shown whole unless an entry's note marks it as a shorter version, and Your artifacts — the pull menu the coach reads from on demand — so Claude understands the purpose of each block it receives. Journal entries are not one of these blocks: when recent entries matter, the coach reads them live, with approval, through the /journal/entries helper.
  • How to Reference What You Know — cite naturally when it deepens conversation, use knowledge silently when it shapes questions, never recite context back, reference bookmarked moments with care.
  • Handling Growth and Change — notice evolution without assuming consistency, treat tensions as exploration opportunities, newer context takes priority over older when they conflict.
  • Avoiding Redundant Questions — don't re-ask what's in prior context unless there's a strategic reason (time-based check-in, different angle, deeper dive, consistency check).
  • Skipping Covered Ground — abbreviate sections already covered in prior artifacts with a brief acknowledgment.
  • The Goal — by interview #5 the user should feel known; by #15, the AI should feel like a thoughtful companion who remembers themes and patterns.

The with-artifacts preamble (the text at the top of ## What You Already Know when artifacts exist) also references the memory layers explicitly: a Core Profile synthesis, personal context (conversation memories), bookmarked moments, any artifacts pinned for this interview (an entry with a note, such as "Summary only", is a shorter version; every other entry is whole), and a menu of every other artifact the coach can pull on demand. The first-interview preamble (no artifacts) says the user has no saved coaching documents yet and tells the coach to use any memories, bookmarks or goal trends listed below; only when nothing is listed does it say there is no prior context to build from.

Validation instrumentation (telemetry)

The memory system emits telemetry events via trackEvent('ai_coaching', action, metadata) so you can verify it's working by querying the feature_events table. All events are local SQLite inserts — $0 AI cost. Every errorClass below uses the app's shared provider classification (http-529, http-429, timeout, or the error's name), the same vocabulary as the anthropic_call events.

Event Fires when Key metadata
memory_context_built Every buildAICoachingClaudeMd() call, every free-form writeCoachingBaseContext() write (immediate path), and every free-form deferred stash (both emit with pinnedCount: 0) All: artifactCount, bookmarkCount, memoryCount, insightCount, claudeMdChars, pinnedCount; interview builds add memoryChars, insightChars, budgetExceeded, free-form degraded, degradedSections
compaction_generated Compaction summary successfully created sessionId, segment, inputTokens, outputTokens
compaction_failed Compaction Haiku call errors sessionId, segment, errorClass
segment_pause_reached An interview reached a pause point, so a pause trigger that stops firing shows up as missing events sessionId, segment
compaction_cost_cap_hit Compaction skipped due to daily cost cap spentUsd, capUsd
memory_extracted Memory facts successfully extracted from a compaction segment sessionId, factCount, rawCount, validCount, inputTokens, outputTokens
memory_extraction_failed Memory extraction Haiku call errors sessionId, errorClass
memories_extracted_from_artifact Memory facts successfully extracted from a saved artifact artifactId, entryCount, inputTokens, outputTokens
artifact_memory_extraction_failed Artifact memory extraction Haiku call errors artifactId, errorClass
memory_cost_cap_hit Memory extraction skipped due to session cost cap spentUsd, capUsd
memory_feedback_eligible Artifact saved and user had prior context (≥ 2 artifacts) sessionId, artifactCount, hadCoreProfile

The snack_started and snack_start_failed events (already firing) are also registered in the action list.

These events are locked by tests in ai-coaching-claude-md.test.ts, ai-coaching-compaction.test.ts and ai-coaching-memory.test.ts.

Goal progress trend windows

The "Goal Progress Trends" block in the coach's context labels each active goal improving, stable or declining by comparing the average of its first N check-in ratings with the average of its last N, where N is the smaller of 3 and half the check-in count (rounded down). The two windows never share a check-in, so a goal with only 2 or 3 check-ins is compared on its first and last rating instead of always reading as stable. A goal with a single check-in has nothing to compare, so the coach is told there is no trend yet: its line reads "no trend yet" with no arrow and a delta of 0, never "stable" (Q-756). A change of more than 0.3 stars is what counts as a direction. Check-ins are ordered oldest first before the windows are taken, and only check-ins for the goals passed in count. At most 10 goals appear, most check-ins first, with the newer goal first on a tie.

The check-ins are read per goal: each active goal contributes its newest 50, so a goal with many recent check-ins never pushes a quieter active goal out of the block. For a goal past 50, the windows are taken from those newest 50, while the count the coach sees and the "most check-ins first" order use the goal's full total (Q-1167).

Implementation: computeGoalProgressTrends() in progress-trend.ts, fed by listRecentCheckinsForContext() in goals.ts. Tests: ai-coaching-progress-trend.test.ts and ai-coaching-goal-status-transitions.test.ts.

Life Inventory trend line in profile summary

When a Life Inventory profile summary is generated for injection into coaching context, the system compares each inventory's latest completed take with its most recent earlier completed take that has ratings. If any category came out better or worse, a trend line is appended to the profile summary:

Trends since last take: Symptoms (between the takes of 2026-09-01 and 2026-10-01) — Sleep improved; Energy worsened

Every part of the coach's Life Inventory text names the day of the take it describes (RT-F009), so an old inventory never reads as current: each profile-summary line ends its label with (taken YYYY-MM-DD), each trend section names the two takes it compares, and each ## Symptoms / ## Strengths heading in life-inventory.md carries the same (taken …) date. The day is the take's finish time in the computer's own time zone (formatLocalYmd, the same day the export file prints); a take with no readable finish time is left undated.

The trend line has one section per inventory, Symptoms and Strengths, each listing its categories in an "improved" and a "worsened" group. Each inventory is counted on its own, so the same category name can appear in both sections. There is no minimum size of change: a category's item rating changes are added up, and any net change counts, however small. On Symptoms a lower rating is the better result, so a drop there reads as improved. An item rated in only one of the two takes is skipped. An inventory with no net change has no section, and if neither has one, or there is no earlier rated take to compare against, the trend line is omitted — the profile summary reads exactly as before.

The trend line is budget-aware: the profile summary has a hard 800-character cap (LIFE_INVENTORY_SUMMARY_CAP). buildProfileSummary first tries to fit the summary WITH the trend line; if that exceeds the cap, it drops the trend line and falls back to the base summary alone. If even the base summary exceeds the cap, it hard-truncates with ….

Implementation: buildTrendLine() and updated buildProfileSummary() in life-inventory-service.ts. Tests: life-inventory-trends.test.ts.

Where the summary goes (F040). The summary — trend line included — reaches exactly ONE context: the coaching session's own CLAUDE.md, where buildLifeInventoryPointerForCoaching() composes it ahead of the life-inventory.md pointer. It is no longer folded into the profile block of ordinary sessions (a coding or research session). The rollup is built from the user's health self-ratings — the catalog behind "Symptoms most present" includes items such as "Depression or persistent sadness" and "Chronic fatigue" — so sending it into unrelated work put special-category data (GDPR Art. 9(1); CCPA sensitive personal information) into that session's opening prompt, on a consent that merely switching AI Coaching on implies rather than the explicit per-purpose grant that category needs.

Life Inventory import

The Life Inventory pane has an Import tab that lets users import a previously exported markdown inventory as a completed take. The flow is two-step: preview then commit.

  1. Preview (LIFE_INVENTORY_IMPORT_PREVIEW) — the user picks a .md / .txt file. The handler parses markdown table rows via life-inventory-import-parser.ts (parseMarkdownInventory), which finds the Item and Rating columns from each table's header row by name (case and spacing ignored, so a plain two-column | Item | Rating | table works) and reads a header-less table by position, matches each row against the catalog by normalized text (matchParsedRows), and returns a preview with match/unmatch counts and a sample of the first 10 rows. No DB write.
  2. Commit (LIFE_INVENTORY_IMPORT_COMMIT) — creates an already-completed take and bulk-inserts the matched ratings in a single SQLite transaction. Refuses if an in-progress take exists for the same inventory type. Regenerates the detail file and emits LIFE_INVENTORY_CHANGED.

Content is capped at 5 MB by the Zod schema. The parser tolerates bold/italic rating markers (**4**, *4*) and normalizes smart quotes. Unmatched rows (items not in the catalog) are reported but skipped.

UI: LifeInventoryImportView.tsx renders the file picker + preview + commit button. Wired into LifeInventoryPane.tsx as the third tab (take / results / import). Tests: life-inventory-import-parser.test.ts (35 tests).

The artifacts these memories and profiles are built from are in part 2, and the CLI surface plus the implementation pointers are in part 4; the AI Coaching sidebar (interview prompts and artifacts) page is the parent.

Last verified 2026-09-28