Repository navigation
Description
Overview
Add lifecycleStatus as a core hub property on all nodes to support knowledge governance. The lifecycle transitions will be policy-driven, allowing users to customize archival and retention behavior according to their needs.
Architecture Context (Updated January 2026)
This issue is part of the Universal Graph Architecture Transition (Epic #783).
The lifecycleStatus field should be added to the hub table now, before the spoke table elimination. This is a clean addition that:
- Works with current Hub-and-Spoke architecture
- Will carry forward unchanged to Pure JSON architecture
- Enables semantic search filtering immediately
Key Design Decision: Lifecycle transitions are controlled by policies (declarative rules), not workflows (reactive events). Policies are evaluated periodically by the Policy Evaluation Engine (#785).
This can be worked on in parallel with or after Stream B (Data Model Transition).
Problem Statement
Users need to archive outdated content without relying on collection naming conventions. Currently:
- No system-level way to mark content as archived
- Semantic search returns all content regardless of relevance/staleness
- Users might create collections named "Archive", "Old", "Historical" - no consistent pattern
Industry standard (SharePoint/Purview, Confluence) uses a system-level status field that search respects by default, with policy-driven transitions.
Proposed Solution
1. Add lifecycleStatus as Core Hub Property
Every node gets this property in the hub table (like nodeType, version, createdAt):
DEFINE FIELD lifecycleStatus ON TABLE node TYPE string DEFAULT "active";
DEFINE INDEX idx_node_lifecycle ON TABLE node COLUMNS lifecycleStatus;Allowed values:
active(default) - included in search, visible in UIarchived- excluded from search by default, hidden from default views, restorabledeleted- soft-deleted, in trash, excluded from all queries, purgeable
2. Define policy Schema (Lifecycle Type)
Policies are nodes that define declarative rules for lifecycle transitions:
{
"id": "node:<uuid>",
"node_type": "policy",
"content": "Archive completed tasks after 90 days",
"properties": {
"policy_type": "lifecycle",
"applies_to": ["task"],
"enabled": true,
"priority": 0,
"trigger": {
"type": "last_modified",
"days": 90,
"condition": "properties.status == 'done'"
},
"action": "archive"
}
}3. Update Semantic Search
Add include_archived parameter (defaults to false):
-- Default: exclude archived and deleted
SELECT * FROM node
WHERE vector::similarity::cosine(embedding, $query_vec) > $threshold
AND lifecycleStatus = 'active'
ORDER BY similarity DESC
LIMIT $limit;
-- With include_archived: true
SELECT * FROM node
WHERE vector::similarity::cosine(embedding, $query_vec) > $threshold
AND lifecycleStatus IN ['active', 'archived']
ORDER BY similarity DESC
LIMIT $limit;4. MCP Tool Update
// search_semantic tool
{
name: "search_semantic",
parameters: {
query: string,
limit?: number,
threshold?: number,
include_archived?: boolean // NEW - defaults to false
}
}Acceptance Criteria
Phase 1: Core Infrastructure
-
lifecycleStatusfield added to SurrealDB node hub table with defaultactive - Index created for efficient lifecycle filtering
-
policyschema defined withpolicy_type: "lifecycle"support - Manual archive/restore actions work (UI buttons)
Phase 2: Search Integration
-
search_semanticexcludes archived/deleted nodes by default -
search_semanticincludes archived nodes wheninclude_archived: true - All node queries filter by lifecycle status appropriately
Phase 3: UI
- UI provides "Archive" action that sets
lifecycleStatus: 'archived' - UI provides "Restore" action that sets
lifecycleStatus: 'active' - UI provides "Delete" action that sets
lifecycleStatus: 'deleted' - Archived nodes display visual indicator (banner, muted styling)
- Deleted nodes only visible in Trash view
Phase 4: Quality
- Documentation updated (architecture docs, MCP tool docs)
- Tests cover archive/restore/delete and search exclusion
- Code passes
bun run quality:fix - Tests pass (
bun run test:all)
Technical Specifications
Reference Files
- Architecture: See architecture-target-state.md
- Node hub table:
packages/desktop-app/src-tauri/src/db/- Add lifecycleStatus field - Semantic search:
packages/desktop-app/src-tauri/src/services/- Add filter parameter - MCP handler:
packages/desktop-app/src-tauri/src/mcp/- Update search_semantic tool
Why Core Hub Property (Not Spoke)?
- System-level concern: Like
nodeTypeorcreatedAt, applies to ALL nodes - Search integration: Must filter at database level for performance
- Consistent behavior: All nodes support archival regardless of type
- Industry standard: SharePoint/Purview, Confluence use system-level flags
Policy vs Workflow Distinction
| Concept | Nature | Example |
|---|---|---|
| Policy | Declarative (continuous filter/rule) | "Archive done tasks after 90 days" |
| Workflow | Reactive (event → action) | "When archived, notify owner" |
Policies are evaluated periodically by the Policy Evaluation Engine (#785).
Policies can trigger workflows (e.g., archiving a node triggers "on_archive" workflow).
Dependencies
- None for Phase 1-3 (foundational infrastructure)
- Policy Evaluation Engine (Policy Evaluation Engine #785) for automated policy execution
Related Issues
- Epic Epic: Universal Graph Architecture Transition #783 - Universal Graph Architecture Transition (parent)
- Remove Hardcoded Node Type Validation - Enable Schema-Based Type Discovery #446 - Remove Hardcoded Node Type Validation
- Sync Policy Infrastructure #784 - Sync Policy Infrastructure
- Policy Evaluation Engine #785 - Policy Evaluation Engine
Activity
Add lifecycleStatus as core hub property for archival and search excl…
malibio commentedon Dec 28, 2025
Architecture Context (Updated December 2025)
This issue is a prerequisite for the Universal Graph Architecture Transition (Epic #783).
The
lifecycleStatusfield should be added to the hub table now, before the spoke table elimination. This is a clean addition that:Dependency: Epic #783 depends on this issue being completed first.
docs: Universal Graph Architecture - target state and PoC plan (#783)
malibio commentedon Jan 26, 2026
Test Baseline (January 26, 2026)
Starting implementation of lifecycle_status core property.
Add lifecycle_status as core node property with semantic search exclu…
Add lifecycle_status as core node property with semantic search exclu…
malibio commentedon Jan 26, 2026
Completed via PR #828.
Implementation Summary
Phase 1: Core Infrastructure ✅
lifecycle_statusfield added to SurrealDB node table with defaultactivePhase 2: Search Integration ✅
search_semanticexcludes archived/deleted nodes by defaultsearch_semanticincludes archived nodes wheninclude_archived: truePhase 3 & 4 (UI and Policy-driven transitions)
UI actions and policy-driven lifecycle transitions are separate concerns tracked in:
The core backend infrastructure is complete and working.
Add lifecycleStatus as core hub property for archival and search excl…
docs: Universal Graph Architecture - target state and PoC plan (#783)
Add lifecycle_status as core node property with semantic search exclu…
Add lifecycleStatus as core hub property for archival and search excl…
docs: Universal Graph Architecture - target state and PoC plan (#783)
Add lifecycle_status as core node property with semantic search exclu…
Add lifecycle_status as core node property with semantic search exclu…