Skip to content

feat: add learn export-kg and NormalizedTerm action metadata (Refs #759, #735)#834

Open
AlexMikhalev wants to merge 3 commits intomainfrom
task/759-export-corrections-markdown
Open

feat: add learn export-kg and NormalizedTerm action metadata (Refs #759, #735)#834
AlexMikhalev wants to merge 3 commits intomainfrom
task/759-export-corrections-markdown

Conversation

@AlexMikhalev
Copy link
Copy Markdown
Contributor

Summary

Two features in one PR:

feat(agent): learn export-kg command (Issue #759)

  • New learn export-kg CLI subcommand that reads captured CorrectionEvent markdown files
  • Groups compatible corrections by their corrected value
  • Emits Logseq-style KG markdown artefacts per unique corrected term
  • Supports --output flag and --correction-type filter

feat(types): add action metadata to NormalizedTerm (Issue #735)

  • Add action, priority, trigger, pinned fields to NormalizedTerm
  • Add same four fields to AutocompleteMetadata for alignment
  • All fields use #[serde(default)] for backward-compatible JSON

Notable Fix

  • bincode bug: #[serde(skip_serializing_if)] on optional fields in HashMap values causes UnexpectedEof on deserialization when fields are None. Removed skip_serializing_if from AutocompleteMetadata fields.

Files Changed

  • crates/terraphim_agent/src/learnings/export_kg.rs (new)
  • crates/terraphim_agent/src/main.rs (ExportKg variant + handler)
  • crates/terraphim_agent/src/learnings/mod.rs (exports)
  • crates/terraphim_types/src/lib.rs (NormalizedTerm fields + methods)
  • crates/terraphim_automata/src/autocomplete.rs (AutocompleteMetadata fields)
  • 9 other files updated with new struct fields

Testing

  • cargo test --workspace passes
  • cargo clippy --workspace --all-targets clean
  • Build verified on all targets including benches and tests

Alex added 3 commits April 22, 2026 17:46
…759

- Add export_kg.rs module with export_corrections_as_kg() function
- Add ExportKg variant to LearnSub CLI enum
- Corrections are grouped by corrected value, exported as Logseq-style KG markdown
- Supports --type tool-preference (default) or --type all filter
- 7 unit tests covering empty dir, single export, merging, filtering, filenames
- clippy clean
…759

- Add export_kg.rs module with export_corrections_as_kg() function
- Add ExportKg variant to LearnSub CLI enum
- Corrections are grouped by corrected value, exported as Logseq-style KG markdown
- Supports --type tool-preference (default) or --type all filter
- 7 unit tests covering empty dir, single export, merging, filtering, filenames
- clippy clean
…raphim/terraphim-ai into task/759-export-corrections-markdown
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