hk feed¶
Add documents to an existing knowledge abstract incrementally.
Synopsis¶
Arguments¶
| Argument | Description |
|---|---|
KA_PATH |
Path to existing knowledge abstract directory |
INPUT |
Input file path or - for stdin |
Options¶
| Option | Short | Description |
|---|---|---|
--template |
-t |
Override template (uses metadata if omitted) |
--lang |
-l |
Override language (uses metadata if omitted) |
Description¶
The feed command adds new documents to an existing knowledge abstract without losing existing data:
- Loads existing knowledge — Reads current knowledge abstract state
- Extracts from new document — Processes the new content
- Merges intelligently — Combines new and existing data, handling duplicates
- Updates metadata — Records the update timestamp
This is ideal for: - Building knowledge abstracts over time - Adding updates to existing documents - Combining information from multiple sources
Examples¶
Basic Usage¶
# Initial extraction
hk parse tesla_bio.md -t general/biography_graph -o ./tesla_kb/ -l en
# Add more content
hk feed ./tesla_kb/ tesla_inventions.md
Feed Multiple Documents¶
Or use a loop:
From Stdin¶
Merge Behavior¶
The merge process handles:
| Scenario | Behavior |
|---|---|
| Same entity | Merged, descriptions combined |
| Same relation | Updated with latest information |
| New entities | Added to knowledge abstract |
| New relations | Added connecting existing/new entities |
Workflow Example¶
Building a Research Knowledge Abstract¶
# Day 1: Initial paper
hk parse paper_v1.md -t general/concept_graph -o ./research_kb/ -l en
hk show ./research_kb/
# Day 7: Updated version
hk feed ./research_kb/ paper_v2.md
hk show ./research_kb/
# Day 14: Related work
hk feed ./research_kb/ related_work.md
hk build-index ./research_kb/
hk talk ./research_kb/ -q "What are the key concepts across all papers?"
Incremental Biography¶
# Start with early life
hk parse early_life.md -t general/biography_graph -o ./bio_kb/ -l en
# Add career period
hk feed ./bio_kb/ career.md
# Add later years
hk feed ./bio_kb/ later_years.md
# Final visualization
hk show ./bio_kb/
Verification¶
Check that the feed worked:
Look for:
- Increased node count
- Increased edge count
- Updated timestamp
Best Practices¶
- Use same template — Feeding should use compatible templates
- Match language — Use consistent language for best results
- Rebuild index after —
hk build-index ./ka/for search/chat - Visualize changes —
hk show ./ka/to see updates
Error Handling¶
"Not a valid Knowledge Abstract directory"¶
The directory doesn't contain a valid knowledge abstract. Check:
"Template mismatch"¶
Feeding works best with the same template type. Override if needed:
See Also¶
hk parse— Create new knowledge abstracthk info— View knowledge abstract statisticshk build-index— Rebuild search index after feeding