feat(plugins): generated titles for agy / pi, complete.run on an agent preset #62

Closed
gabrielvidal wants to merge 0 commits from conversation-titles into main
pull from: conversation-titles
Owner

Summary

agy and pi conversations have no title: Claude Code writes its own ai-title and opencode's mirror sends its session title, but agy and pi send nothing, so their cards show the first 90 characters of the prompt. This PR adds the core contracts the new conversation-titles plugin (ai-agent-plugins #59) needs: a generated title that ranks like Claude's own, bridges to list untitled conversations and write a title, and complete.run calls that take their model from an agent preset. That last part is what makes the model configurable in Settings → Agent presets.

Key changes

  • conversations/cards.py _conv_title: meta.title › resource title › meta.autoTitle › parsed title (Claude's ai-title, else the first prompt). meta.py documents the key.
  • conversations/title_pending.py (new): the top-level conversations of the given harnesses with a user turn and neither autoTitle nor meta.title. sid answers from the meta's harness stamp before the transcript is indexed.
  • plugins/hubcomplete.py:
    • GET …/hub/labels/untitled?harness=agy,pi&days=&limit=&sid= and POST …/hub/labels/title {sessionId, title, model} (under conversations.label). A title is cleaned to one line and at most 120 characters. An empty answer is stored as null (never asked again) but never replaces a title already written.
    • complete.run takes preset: "default" | "<id>" (+ profile). default means the preset the owner set for source plugin:<id>. It is resolved by the runs.route provider (run_router.resolve_new_run). The plugin's own model becomes the fallback and answers alone when no preset is set. The answer adds route.
    • GET …/hub/complete/route: the same route, without making a call (for the plugin's settings page).
  • plugins/run_router.py sources(): a plugin holding complete.run that names the routing provider in requires / optionalRequires is listed as a source (uses: "complete"). Plugins holding runs.start are listed as before (uses: "runs").
  • runs/service.py: the conversation.started event carries harness.
  • docs/plugins.md (one-shot completions section, capability table, event payload) and CLAUDE.md (title order).

Key decisions

  • Rank like Claude's own title (Gabriel's pick in the design form): a separate meta.autoTitle, not meta.title with titleSource: agent. A generated title therefore never hides your rename, the agent's own conv title or a ticket's resource title. Resetting a rename falls back to it.
  • The preset is resolved in core, not by the plugin: preset definitions live in the agent-presets plugin's data, which another plugin can't read. complete.run forwards to the existing runs.route resolve op, with stamp: {plugin: <id>} as the source, so the "default per source" mechanism works unchanged. The conversation's profile is passed along, so a Work conversation is asked on Work logins.
  • Opting in as a source via optionalRequires instead of a new manifest key or capability: a plugin that "works with agent-presets" is exactly the one whose calls honour its source preset. conversation-labels also holds complete.run, but has its own model picker, so it isn't listed (it doesn't name the provider).
  • The plugin's own model as an automatic fallback keeps a title coming when the preset's route fails.

Changelog

  • Added: agy and pi conversations can get a short generated title (with the conversation-titles plugin). Your rename and the agent's own title still win.
  • Added: plugins that ask a model for one-off answers can take it from an agent preset; they appear under Settings → Agent presets.

Test notes

  • bwrap throwaway-/data runs:
    • test_hubcomplete.py: 18 passed (new: preset args, route → fallback, route_preset, clean_title / write_title incl. the empty-answer guard, title_pending, _conv_title order).
    • test_run_router.py: 16 passed (new: sources with uses, complete.run on the source preset end to end through the bridge incl. no-preset / unknown preset / dry-run route, untitled + title bridges and their capability check).
    • test_plugin_deps_agents.py: 13 passed (harness in the event).
    • The other 59 test_plugin*, test_conv*, test_runs*… modules: no failures.
  • Live local hub (this branch, real agent-presets from the plugins branch, 6 real agy transcripts from the last 2 days, a stand-in sidecar /complete):
    • The source appears under Plugins that use a model, seeded to Background.
    • GET hub/complete/route → Background → Claude Haiku 4.5.
    • The EVOX2's claude -p login has expired, so real titles were made on the local inkling-2-mini through a test preset assigned to the source. All 6 cards got titles (screenshots in ai-agent-plugins #59).
    • A user rename won over the generated title, and resetting it brought the generated title back.
  • Not deployed: deploy the hub from the Homelab after merge (ai-agent-deploy). Merge this before ai-agent-plugins #59.

🤖 Generated with Claude Code

## Summary agy and pi conversations have no title: Claude Code writes its own `ai-title` and opencode's mirror sends its session title, but agy and pi send nothing, so their cards show the first 90 characters of the prompt. This PR adds the core contracts the new **conversation-titles** plugin (ai-agent-plugins #59) needs: a generated title that ranks like Claude's own, bridges to list untitled conversations and write a title, and `complete.run` calls that take their model from an **agent preset**. That last part is what makes the model configurable in Settings → Agent presets. ## Key changes - `conversations/cards.py` `_conv_title`: `meta.title` › resource title › **`meta.autoTitle`** › parsed title (Claude's `ai-title`, else the first prompt). `meta.py` documents the key. - `conversations/title_pending.py` (new): the top-level conversations of the given harnesses with a user turn and neither `autoTitle` nor `meta.title`. `sid` answers from the meta's `harness` stamp before the transcript is indexed. - `plugins/hubcomplete.py`: - `GET …/hub/labels/untitled?harness=agy,pi&days=&limit=&sid=` and `POST …/hub/labels/title {sessionId, title, model}` (under `conversations.label`). A title is cleaned to one line and at most 120 characters. An empty answer is stored as `null` (never asked again) but never replaces a title already written. - `complete.run` takes `preset: "default" | "<id>"` (+ `profile`). `default` means the preset the owner set for source `plugin:<id>`. It is resolved by the `runs.route` provider (`run_router.resolve_new_run`). The plugin's own model becomes the fallback and answers alone when no preset is set. The answer adds `route`. - `GET …/hub/complete/route`: the same route, without making a call (for the plugin's settings page). - `plugins/run_router.py` `sources()`: a plugin holding `complete.run` that names the routing provider in `requires` / `optionalRequires` is listed as a source (`uses: "complete"`). Plugins holding `runs.start` are listed as before (`uses: "runs"`). - `runs/service.py`: the `conversation.started` event carries `harness`. - `docs/plugins.md` (one-shot completions section, capability table, event payload) and `CLAUDE.md` (title order). ## Key decisions - **Rank like Claude's own title** (Gabriel's pick in the design form): a separate `meta.autoTitle`, not `meta.title` with `titleSource: agent`. A generated title therefore never hides your rename, the agent's own `conv title` or a ticket's resource title. Resetting a rename falls back to it. - **The preset is resolved in core, not by the plugin**: preset definitions live in the agent-presets plugin's data, which another plugin can't read. `complete.run` forwards to the existing `runs.route` `resolve` op, with `stamp: {plugin: <id>}` as the source, so the "default per source" mechanism works unchanged. The conversation's `profile` is passed along, so a Work conversation is asked on Work logins. - **Opting in as a source via `optionalRequires`** instead of a new manifest key or capability: a plugin that "works with agent-presets" is exactly the one whose calls honour its source preset. conversation-labels also holds `complete.run`, but has its own model picker, so it isn't listed (it doesn't name the provider). - The plugin's own model as an automatic fallback keeps a title coming when the preset's route fails. ## Changelog - Added: agy and pi conversations can get a short generated title (with the conversation-titles plugin). Your rename and the agent's own title still win. - Added: plugins that ask a model for one-off answers can take it from an agent preset; they appear under Settings → Agent presets. ## Test notes - `bwrap` throwaway-`/data` runs: - `test_hubcomplete.py`: 18 passed (new: preset args, route → fallback, `route_preset`, `clean_title` / `write_title` incl. the empty-answer guard, `title_pending`, `_conv_title` order). - `test_run_router.py`: 16 passed (new: sources with `uses`, complete.run on the source preset end to end through the bridge incl. no-preset / unknown preset / dry-run route, untitled + title bridges and their capability check). - `test_plugin_deps_agents.py`: 13 passed (`harness` in the event). - The other 59 `test_plugin*`, `test_conv*`, `test_runs*`… modules: no failures. - **Live local hub** (this branch, real agent-presets from the plugins branch, 6 real agy transcripts from the last 2 days, a stand-in sidecar `/complete`): - The source appears under *Plugins that use a model*, seeded to Background. - `GET hub/complete/route` → Background → Claude Haiku 4.5. - The EVOX2's `claude -p` login has expired, so real titles were made on the local `inkling-2-mini` through a test preset assigned to the source. All 6 cards got titles (screenshots in ai-agent-plugins #59). - A user rename won over the generated title, and resetting it brought the generated title back. - Not deployed: deploy the hub from the Homelab after merge (`ai-agent-deploy`). **Merge this before ai-agent-plugins #59.** 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gabrielvidal self-assigned this 2026-12-02 21:48:49 +01:00
gabrielvidal added 1 commit 2026-12-02 21:48:49 +01:00
agy and pi name nothing themselves (Claude Code writes ai-title, opencode's
mirror its session title), so their cards read the first prompt. Core side
of the conversation-titles plugin:

- meta.autoTitle: cards._conv_title reads it like Claude's own title — the
  owner's rename, the agent's conv title and a resource title win, it beats
  the first prompt.
- conversations.label bridges: GET hub/labels/untitled?harness=agy,pi
  (conversations/title_pending.py — sid answers from the meta's harness
  before the transcript is indexed) and POST hub/labels/title (an empty
  answer is stored as null — never asked again — but never replaces a title).
- complete.run on an agent preset: preset "default" (the source's preset in
  Settings → Agent presets) or "<id>", resolved by the runs.route provider on
  the call's profile; the plugin's own model becomes the fallback and answers
  alone with no preset set. GET hub/complete/route: that route, no call.
- run_router.sources(): complete.run holders naming the routing provider in
  requires / optionalRequires are listed as sources (uses: complete).
- conversation.started carries the run's harness.
- docs/plugins.md + CLAUDE.md; tests in test_hubcomplete, test_run_router,
  test_plugin_deps_agents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner
Merged into `main` as 8e4f5d32 by the auto-ship batch https://ai-agent.lab.gabvdl.xyz/conversation/01a2390d-9150-7154-a571-1e75ba9e953f.
gabrielvidal closed this pull request 2026-12-03 00:34:50 +01:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gabrielvidal/ai-agent#62