Repository navigation
[FEATURE] show which entities do not have relations #762
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Activity
Claude finished @phernandez's task in 9m 29s —— View job •
claude/issue-762-20260423-0204• Create PR ➔
Triage & Implementation Complete
Classification: Feature request | Component: CLI + API | Priority: Medium | Complexity: Medium
- Analyze issue and classify request
- Explore codebase (CLI structure, entity/relation models)
- Add
find_without_relationsmethod toEntityRepository - Add
OrphanEntitiesResponseschema toschemas/v2/graph.py - Add
GET /knowledge/orphansAPI endpoint - Add
get_orphansmethod toKnowledgeClient - Create
cli/commands/orphans.pyCLI command - Register command in
main.pyand__init__.py - Add tests (repository, API endpoint, CLI)
- Commit and push
What was implemented
New command:
basic-memory orphans [--project NAME] [--json] [--local] [--cloud]Displays a table of entities that have no incoming or outgoing relations — isolated nodes in the knowledge graph. These may be newly created notes not yet linked to other entities, or notes whose relations were removed.
Example output:
test-project: Entities Without Relations (3 total) ┌──────────────────┬─────────────────────────┬───────┐ │ Title │ File Path │ Type │ ├──────────────────┼─────────────────────────┼───────┤ │ Meeting Notes │ meetings/2024-01-15.md │ note │ │ Draft Ideas │ drafts/ideas.md │ │ │ Temp Scratch │ scratch/temp.md │ note │ └──────────────────┴─────────────────────────┴───────┘Files changed:
src/basic_memory/repository/entity_repository.py—find_without_relations()using SQL EXISTSsrc/basic_memory/schemas/v2/graph.py—OrphanEntitiesResponseschemasrc/basic_memory/schemas/v2/__init__.py— export new schemasrc/basic_memory/api/v2/routers/knowledge_router.py—GET /knowledge/orphansendpointsrc/basic_memory/mcp/clients/knowledge.py—get_orphans()client methodsrc/basic_memory/cli/commands/orphans.py— new CLI command (created)src/basic_memory/cli/commands/__init__.py+cli/main.py— register commandtests/repository/test_entity_repository.py— 3 new repository teststests/api/v2/test_orphan_router.py— 4 new API endpoint tests (created)tests/cli/test_orphans_command.py— 3 new CLI tests (created)
|
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Add a cli utility to show which entities do not have relations