---
title: KMS knowledge aggregation (periodic AI-curated session summary notes)
---

# KMS knowledge aggregation (periodic AI-curated session summary notes)

## What it is

Omniscio can automatically collect notable outputs from your coding sessions, run selective AI deep-dives on the most interesting ones, and synthesize everything into periodic summary notes (daily and/or weekly) written as markdown files inside your [KMS vault](kms.md)'s `Agent Insights/` folder.

**Knowledge aggregation** is a background pipeline that turns your accumulated session activity into curated, human-readable knowledge notes. Instead of manually reviewing dozens of sessions, Omniscio's aggregation worker scans sessions from a time period, identifies the most notable ones (by engagement, cost, keywords like "fix", "bug", "refactor", "decision"), extracts key insights using a small AI model (Claude Haiku), and writes a single summary note per project.

The feature is opt-in and cost-capped. All AI calls use the cheapest available model (Haiku), and a configurable micro-dollar cost cap prevents runaway spend. The periodic worker runs alongside the KMS service; it starts when KMS starts and stops when KMS stops.

**Everything here is gated by two settings**: the master `nothariEnabled` setting (Settings → Features → Enable KMS) AND `nothariAggregationEnabled` (the aggregation-specific toggle). Both must be on for the worker to run.

## Where to find it

Its output lands where you already read notes — an **Agent Insights** folder inside your KMS vault, one summary note per project. The pipeline itself is switched on in **Settings**, where it is opt-in and carries a spend cap you set.

## How it behaves

### Settings

All settings use the `nothari` prefix (the internal persistence name for KMS).

| Setting                             | Default                       | What it controls                            |
| ----------------------------------- | ----------------------------- | ------------------------------------------- |
| `nothariAggregationEnabled`         | `false`                       | Master on/off for the aggregation feature   |
| `nothariAggregationDaily`           | `false`                       | Run daily aggregation                       |
| `nothariAggregationWeekly`          | `true`                        | Run weekly aggregation                      |
| `nothariAggregationDailyHour`       | `6`                           | Hour (0-23) to run daily aggregation        |
| `nothariAggregationWeeklyDay`       | `0`                           | Day of week (0=Sun) for weekly aggregation  |
| `nothariAggregationWeeklyHour`      | `6`                           | Hour (0-23) to run weekly aggregation       |
| `nothariAggregationCostCapMicroUsd` | `500000`                      | Max micro-USD per run ($0.50 default)       |
| `nothariAggregationDeepDiveMax`     | `10`                          | Max sessions to deep-dive per project       |
| `nothariAggregationSections`        | all on except `openQuestions` | Which sections to include in notes          |

### Cost and safety

- All AI calls use **Haiku** (the cheapest model tier)
- A **cost cap** (`nothariAggregationCostCapMicroUsd`) stops the pipeline mid-run if cumulative cost exceeds the limit
- The "Run Now" action can bypass the cost cap when explicitly requested (`bypassCostCap: true`)
- Cost is tracked per-run in the `nothari_aggregation_runs` database table using integer micro-USD (the monetary-integer-twin pattern)
- Runs that find no sessions in the period are recorded as `skipped_no_sessions` (no AI cost)
- Errors are recorded with their message for debugging
- The worker raises **inbox alerts** when the cost cap is hit or a run fails entirely (dedup keys `kms-aggregation-cost-cap` and `kms-aggregation-error`), each linking to KMS settings

## For agents

### How it works

### Three-stage pipeline

1. **Collect** (free) — queries the database for sessions that ran during the period, LEFT JOINed with their summaries. Groups sessions by project. No API calls, no cost.

2. **Deep-dive selection** (selective AI) — scores each session for "notability" using heuristics:
   - High turn count (above the 75th percentile of all sessions in the period)
   - Long engagement duration
   - High token/dollar cost
   - Keyword matches in the summary (fix, bug, refactor, decision, pattern, workaround, lesson, migration, breaking)
   - Whether the session spawned child sessions
   - Whether the session wrote to the vault

   The top N sessions (configurable via `nothariAggregationDeepDiveMax`, default 10) get a Haiku extraction call that pulls out decisions, patterns, bugs found, lessons learned, and open questions.

3. **Synthesize** (one AI call per note) — combines the extracted insights plus session metadata into a single markdown note with configurable sections (decisions, patterns, bugs, lessons, open questions, activity summary, vault activity).

### Output

Each run produces one note per project that had sessions in the period, plus an "Everything" roll-up across all projects. Notes land at:

```
Agent Insights/{ProjectName}/2026-07-12 Daily.md
Agent Insights/{ProjectName}/2026-W28 Weekly.md
Agent Insights/Everything/2026-07-12 Daily.md
```

Notes include YAML frontmatter with metadata (period type, date range, session count, cost) and markdown sections based on what the user has enabled.

### CLI access

Agents can trigger and monitor aggregation via the CLI control server:

| Method  | Path                        | What it does                                                      |
| ------- | --------------------------- | ----------------------------------------------------------------- |
| `POST`  | `/kms/aggregation/run`      | Trigger an aggregation run (body: `{periodType, bypassCostCap?}`) |
| `GET`   | `/kms/aggregation/status`   | Current status + latest daily/weekly run info                     |
| `GET`   | `/kms/aggregation/history`  | List of past runs (up to 50)                                      |
| `GET`   | `/kms/aggregation/settings` | Read aggregation settings                                         |
| `PATCH` | `/kms/aggregation/settings` | Update aggregation settings                                       |

The run, status, and history routes require KMS to be enabled (403 otherwise). Settings routes are always accessible.

### IPC channels

- `KMS_AGGREGATION_RUN_NOW` — trigger an on-demand run
- `KMS_AGGREGATION_STATUS` — get current status
- `KMS_AGGREGATION_HISTORY` — list past runs

### Database

The `nothari_aggregation_runs` table (migration `20260714003031`) records every run with:

- Period type and date range
- Project ID (nullable for "Everything" roll-ups)
- Vault ID and relative path of the written note
- Session count, deep-dive count, cost in micro-USD
- Status: `completed`, `skipped_no_sessions`, `skipped_cost_cap`, `error`
- Error message (for failed runs)

## Related

The vault these notes are written into, and the editor you read them in, is described on the [KMS](kms.md) page. The per-note AI summaries are a separate feature on [KMS summaries](kms-summaries.md).
