Skip to content

feat(curation): route container-folder sessions to their topic - #24

Merged
philtief merged 3 commits into
mainfrom
feat/topic-routing
Sep 29, 2026
Merged

philtief merged 3 commits into
mainfrom
feat/topic-routing

Conversation

@philtief

Copy link
Copy Markdown
Owner

Problem

The user often starts work on unrelated topics from container folders: the home directory, ~/work/30-demos/code, ~/work/50-communications/emails. The curation backlog grouped sessions by folder name, so the curator wrote pages like topics/emails that mixed unrelated work, for example an interview script next to a deck rename. Two folders covered by one page also became two backlog items.

Change

  • Storage. A new session_topics table (SQLite 0004, PostgreSQL 0007, forward-only and pinned in the immutability test) records a session's page, or NULL when it holds nothing worth keeping.

  • Grouping by page. session_targets resolves every session in order:

    1. a routed page;
    2. for container-folder sessions, nothing yet (they wait for routing);
    3. otherwise the covering topics/ page of the folder, else topics/<folder>.

    The backlog and the curator's evidence pack group by that page.

  • Config. curation.generic_workspaces (env WIKIBRICKS_CURATION_GENERIC_WORKSPACES) lists the container folder names. The default is code, emails, work, projects, repos, src, documents, desktop, downloads, tmp, and the home directory always counts.

  • Routing. One model call per night, before the backlog: unrouted container-folder sessions (title and first user messages, 600 characters) plus the existing topics/ and projects/ pages.

    • Each session gets a candidate page, a new topics/<slug> named after the subject, or null, which is reserved for one-off questions, tool tests and small talk.
    • Routes are validated, one retry is allowed, and a failure never blocks curation.
    • Pages named after a container folder, such as the old topics/emails, are not candidates.
  • Timing. A session routed after its page's last update counts as new evidence for that page.

Verification

  • 255 tests pass after merging main (fix(curation): record the real author of applied curation changes #23), including PostgreSQL, and Ruff is clean. uv.lock is unchanged.
  • On a copy of the live store, 21 of 112 sessions with a working directory are in container folders; the other 91 keep grouping by their folder.
  • First run with real GLM 5.3 Flash: 6 sessions routed with 0 invalid routes, then 5 of 5 backlog pages applied in 86 s. But 4 of 6 sessions went to null, including two interview scripts. The null rule was tightened in the prompt.
  • After the fix: 6 of 6 sessions routed by content:
    • "Configure Slide Hub MCP", from the emails folder, to topics/slide-hub;
    • two interview scripts to topics/interviewing;
    • an email drafting the Iceberg advisory to topics/iceberg-to-delta-migration;
    • a Fable 5 troubleshooting session to topics/claude-model-availability;
    • an L100 deck redesign to topics/l100-coding-agent-slides.

GLM 5.3 Flash wrote the implementation in two steps. Review added the routed-time rule and candidate filtering, and tightened the null rule after the first real run.

This pull request and its description were written by Isaac.

philtief and others added 3 commits September 29, 2026 10:58
Sessions from container folders (home, code, emails, work, ...) mixed
unrelated work into pages like `topics/emails`.

- New `session_topics` table (SQLite 0004, PostgreSQL 0007) records the
  page a session belongs to, or NULL when it holds nothing durable.
- `session_targets` resolves every session: a routed page first; sessions
  in container folders wait for routing; others go to the covering
  `topics/` page of their folder, else `topics/<folder>`.
- The backlog and the curator's evidence pack group by that page, so two
  folders covered by one page yield one backlog item.
- `curation.generic_workspaces` (env WIKIBRICKS_CURATION_GENERIC_WORKSPACES)
  lists the container folder names.

Implemented by GLM 5.3 Flash; PostgreSQL tests rerun in review.

Co-authored-by: Isaac <no-reply@databricks.com>
Before building the backlog, the nightly curator sends unrouted sessions
from container folders (home, code, emails, ...) and the existing topic
pages to the model in one call. Each session goes to an existing page, a
new `topics/<slug>` named after the subject, or null for throwaway work;
the answer is stored in `session_topics`, so each session is routed once.

- Routes are validated: known session, candidate or well-formed new path,
  never a container-folder name. Invalid routes are retried next night.
- Pages named after a container folder (an old `topics/emails`) are not
  offered as candidates.
- A session routed after its page's last update counts as new evidence
  for that page, so its content reaches the page.
- One retry; a routing failure is reported and never blocks curation.

Acceptance with GLM 5.3 Flash on a copy of the live store: 6 of 6
sessions routed by content (e.g. a Slide Hub MCP session from the emails
folder to `topics/slide-hub`, two interview scripts to
`topics/interviewing`), 0 invalid, then 5 of 5 pages applied.

Implemented by GLM 5.3 Flash; candidate filtering and the null rule
tightened in review after the first real run discarded 4 of 6 sessions.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@philtief
philtief merged commit eeaafc2 into main Sep 29, 2026
3 checks passed
@philtief philtief mentioned this pull request Sep 29, 2026
@philtief
philtief deleted the feat/topic-routing branch September 29, 2026 09:33
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