Skip to content

feat(store,cli): cascade DeleteProject + engram delete session|prompt|project sub-commands#441

Merged
Alan-TheGentleman merged 1 commit into
mainfrom
feat/cli-cascade-delete
May 28, 2026
Merged

feat(store,cli): cascade DeleteProject + engram delete session|prompt|project sub-commands#441
Alan-TheGentleman merged 1 commit into
mainfrom
feat/cli-cascade-delete

Conversation

@Alan-TheGentleman
Copy link
Copy Markdown
Collaborator

Summary

  • Implements store.DeleteProject(name, hardDelete) with atomic cascade in a single transaction: orphans memory_relations referencing project observations, removes observations (soft or hard), removes prompts, and removes sessions (hard only — FK constraint prevents session removal while soft-deleted observations still reference them).
  • Returns ErrProjectNotFound when no entities exist for the project.
  • Adds three CLI sub-commands under engram delete: session <id>, prompt <id>, project <name> [--hard]. Reuses the existing soft/--hard flag pattern from engram delete <id> (feat(cli): add engram delete command to remove observations #209).
  • Backward compatible: engram delete <obs_id> still works (dispatcher falls through to observation delete when the second arg is not a recognized keyword).

Files

internal/store/store.go, internal/store/store_test.go, cmd/engram/main.go (cmdDelete dispatch + printUsage), cmd/engram/main_test.go, README.md (CLI reference), docs/ARCHITECTURE.md (CLI reference).

Test plan

  • Store: TestDeleteProjectCascadesAllEntities, TestDeleteProjectSoftDeleteObservations, TestDeleteProjectUnknownProjectReturnsError, TestDeleteProjectEmptyNameReturnsError, TestDeleteProjectOrphansMemoryRelations.
  • CLI: 14 tests across delete session|prompt|project, missing/invalid arg cases, --hard flag, and backward-compat for delete <obs_id>.
  • go test ./... && go vet ./... && go build ./... clean.

Note

Soft-delete leaves sessions intact: observations.session_id TEXT NOT NULL REFERENCES sessions(id) blocks session deletion while soft-deleted observation rows still exist. Callers needing full session removal should use --hard, or follow up with engram delete session <id> per session.

Closes #218
Closes #219

…or sessions and prompts

Implements store.DeleteProject (hard/soft, transactional, orphans memory_relations)
and three new CLI sub-commands: engram delete session <id>, engram delete prompt <id>,
engram delete project <name> [--hard]. Backward-compat: bare engram delete <obs_id>
still works. README and ARCHITECTURE CLI reference tables updated.

Closes #218
Closes #219
Copilot AI review requested due to automatic review settings May 28, 2026 14:41
@Alan-TheGentleman Alan-TheGentleman added the type:feature New feature label May 28, 2026
@Alan-TheGentleman Alan-TheGentleman merged commit 36a3bbf into main May 28, 2026
8 of 9 checks passed
@Alan-TheGentleman Alan-TheGentleman deleted the feat/cli-cascade-delete branch May 28, 2026 14:43
@Alan-TheGentleman Alan-TheGentleman review requested due to automatic review settings May 28, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): add delete commands for prompts, sessions, and projects feat(store): add whole-project cascade delete API

1 participant