Commit bed9a46
committed
fix(knowledge): fix metadata column name, add path field, surface item_path in results
- Bug fix: rename metadata_ → metadata in schema DDL and INSERT SQL
The Python ORM attribute name metadata_ was leaking into SQL column names.
Add migration v2 to idempotently rename the column on existing databases.
- Bug fix: remove phantom knowledge_items rows when no path is provided
store_knowledge with source but no path no longer creates spurious
knowledge_sources/knowledge_items rows. Instead, item_id=NULL is used
and the source name is recorded in the proposition's metadata field.
- Feature: add optional path parameter to store_knowledge
When both source and path are provided, creates/upserts knowledge_sources
and knowledge_items rows for full provenance tracking, using
ON CONFLICT (source_id, path) for idempotent repeated stores.
- Feature: surface item_path in search and recall results
build_vector_search_query, build_fts_search_query, and _op_recall now
LEFT JOIN knowledge_items and SELECT ki.path AS item_path so callers
can see where a proposition came from.
- Schema: add unique index idx_ki_source_path on knowledge_items(source_id, path)
Required for the ON CONFLICT upsert in _op_store.1 parent 0e7bafc commit bed9a46
15 files changed
Lines changed: 1304 additions & 683 deletions
File tree
- docs/llm
- scripts
- src/workflows_mcp
- engine
- knowledge
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
573 | | - | |
574 | | - | |
| 573 | + | |
575 | 574 | | |
576 | 575 | | |
577 | 576 | | |
| |||
873 | 872 | | |
874 | 873 | | |
875 | 874 | | |
876 | | - | |
877 | 875 | | |
878 | 876 | | |
879 | 877 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
695 | | - | |
696 | 695 | | |
697 | 696 | | |
698 | 697 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1990 | 1990 | | |
1991 | 1991 | | |
1992 | 1992 | | |
1993 | | - | |
1994 | | - | |
1995 | | - | |
1996 | | - | |
1997 | | - | |
1998 | | - | |
1999 | | - | |
2000 | | - | |
2001 | | - | |
2002 | | - | |
2003 | | - | |
2004 | | - | |
2005 | 1993 | | |
2006 | 1994 | | |
2007 | 1995 | | |
| |||
3943 | 3931 | | |
3944 | 3932 | | |
3945 | 3933 | | |
3946 | | - | |
| 3934 | + | |
3947 | 3935 | | |
3948 | 3936 | | |
3949 | 3937 | | |
| |||
4003 | 3991 | | |
4004 | 3992 | | |
4005 | 3993 | | |
4006 | | - | |
4007 | | - | |
4008 | | - | |
4009 | | - | |
4010 | | - | |
4011 | | - | |
4012 | | - | |
4013 | | - | |
4014 | | - | |
4015 | | - | |
4016 | | - | |
4017 | | - | |
4018 | 3994 | | |
4019 | 3995 | | |
4020 | 3996 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
638 | | - | |
639 | 638 | | |
640 | 639 | | |
641 | 640 | | |
| |||
677 | 676 | | |
678 | 677 | | |
679 | 678 | | |
680 | | - | |
681 | | - | |
| 679 | + | |
| 680 | + | |
682 | 681 | | |
683 | 682 | | |
0 commit comments