Skip to content

feat: citation & source attribution system #348

Closed

Description

@ajianaz

Motivation

GBrain enforces inline [Source: ...] citations on every fact written, with a dedicated skill (citation-fixer) that audits and fixes broken citations. This creates traceable, trustworthy memory.

Uteke memories currently have no provenance tracking — you can't tell where a memory came from (user input? imported? derived from another memory?).

Proposal

Add source metadata to every memory, with audit capabilities — all local, zero LLM.

Source Field (schema addition)

Add source and source_type columns to existing memories table:

ALTER TABLE memories ADD COLUMN source TEXT;        -- free-form: URL, file path, "user", "import"
ALTER TABLE memories ADD COLUMN source_type TEXT;   -- enum: user, url, file, import, derived, unknown

Source Types (enum)

pub enum SourceType {
    User,      // directly from user input
    Url,       // extracted from a web page
    File,      // from a local file
    Import,    // bulk imported (JSONL)
    Derived,   // synthesized from other memories (consolidation)
    System,    // system-generated (migration, backfill)
    Unknown,   // legacy data without source
}

CLI Usage

# Remember with source
uteke remember "Rust 1.85 stabilized async traits" --source "https://blog.rust-lang.org/2025..." --source-type url

# Audit: find memories without sources
uteke audit sources --missing

# Audit: breakdown by source type
uteke audit sources --stats

Recall Display

When displaying recall results, show source inline:

[0.89] Rust 1.85 stabilized async traits
       Source: https://blog.rust-lang.org/... | Type: url | Created: 2026-06-14

Auto-Attribution Rules

Operation Default Source
uteke remember (CLI) user
uteke import import:<filename>
Consolidation derived:<source_ids>
Shell hook shell
MCP remember mcp:<client>

User can override with --source flag.

Scope

  • Add source + source_type columns + migration
  • Add --source and --source-type CLI flags to remember
  • Auto-attribute source in all write paths
  • Add uteke audit sources subcommand (missing report, breakdown)
  • Display source in recall/list output
  • Include source in JSONL export
  • Backfill: set source_type = unknown for existing memories
  • Tests: attribution rules, audit, export roundtrip

Non-Goals

  • LLM-based citation verification (out of scope)
  • Web scraping to verify URL sources (external dependency)
  • Citation format standardization (just track the source string)

References

  • GBrain: skills/citation-fixer/SKILL.md — citation audit + fix workflow
  • GBrain convention: skills/conventions/quality.md — Iron Law back-linking

Activity

  1. added this to the milestone on Jun 14, 2026
  2. added
    enhancement
    scope:core
    scope:cli
    type:feature
    epic:memory-engine
    on Jun 14, 2026
  3. modified the milestones: , v0.2.1 — DX & Ecosystem on Jun 14, 2026
  4. added 2 commits that reference this issue on Jun 19, 2026
  5. added a commit that references this issue on Jun 19, 2026
  6. added a commit that references this issue on Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementepic:memory-enginepriority:mediumscope:cliscope:coretype:feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions