Skip to content

Per-title KG switching for publishing pipeline #47

@AlexMikhalev

Description

@AlexMikhalev

Parent

Epic: #43

Problem

The terraphim KG is global (~/.config/terraphim/kg/). When working on multiple book titles, KG entries from one title should not interfere with another. Need a mechanism to activate/deactivate per-title entries.

Proposed Solution

Script: publishing/scripts/switch-title.sh <slug>

Directory Structure

~/.config/terraphim/kg/
  bun.md                          # global (always active)
  bun_install.md                  # global
  Terraphim AI.md                 # global
  publishing/                     # publishing-specific
    context-graphs-for-engineers/
      context graph.md
      decision trace.md
      ...
    title-2-slug/
      ...
  .active-title                   # marker: current slug

switch-title.sh Behavior

  1. Read current active title from ~/.config/terraphim/kg/.active-title
  2. If different from requested slug:
    • Remove symlinks from previous title's entries in the KG root
    • Create symlinks for new title's entries: kg/publishing/<slug>/*.md -> kg/
    • Update .active-title marker file
  3. Rebuild Aho-Corasick automata: terraphim-agent graph --role "Publishing Editor"
  4. Report: "Switched from to , N entries activated"

Alternative (simpler)

Instead of symlinks, the role config (#45) already points to kg/publishing/. If terraphim-agent scans subdirectories recursively, no switching is needed -- just update .active-title for the ${ACTIVE_TITLE_DIR} haystack substitution.

Need to verify: does terraphim-agent scan kg/publishing/ recursively or only the root?

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions