ADR-002: Data Model Refinements
Status: Accepted Date: 2025-04-26 Decision makers: Jarrod Barnes (Founder), Core Eng Team Context: After initial implementation of the data model, we identified several refinements needed to fully support the hover and trace-history features in Arc Memory.
1 · Problem Statement
The current data model is missing several key elements needed for efficient tracing of decision history:- There is no explicit
File
node type, making it difficult to connect file+line to modifying commits - Node attribute naming is inconsistent with the intended schema
- Some attributes that should be optional are required
- Edge direction standards are not explicitly defined
- The build manifest structure is more complex than needed
2 · Proposed Changes
2.1 Add File Node Type
Add a dedicatedFileNode
class to represent files in the repository:
- Connect file+line to modifying commits via
MODIFIES
edges - Store file-specific metadata (path, language, etc.)
- Establish a clear starting point for trace history queries
2.2 Rename created_at
to ts
Rename the created_at
field in the Node
base class to ts
for consistency:
2.3 Make title
and body
Optional
Update the Node
base class to make title
and body
optional with default values:
2.4 Ensure Consistent Edge Direction
Explicitly define and enforce a consistent edge direction standard:- All edges stored in forward direction (
src → dst
) - Commit → File uses
MODIFIES
- PR → Commit uses
MERGES
- Issue → Commit/PR uses
MENTIONS
- ADR → Commit/File uses
DECIDES
2.5 Simplify Build Manifest
Simplify theBuildManifest
model to match the suggested structure:
3 · Alternatives Considered
3.1 Using Bidirectional Edges
We considered storing edges in both directions (e.g., both Commit → File and File → Commit) to simplify certain queries. However, this would:- Double the number of edges in the database
- Increase storage requirements
- Complicate edge creation and maintenance
- Potentially introduce inconsistencies
3.2 Adding User Nodes
We considered adding a dedicatedUserNode
type to represent authors and contributors. However:
- It’s not required for the decision-trail MVP
- Author information can be stored in
Commit.extra["author"]
- It would add complexity to the schema
- It would require additional edges and queries
4 · Impact
4.1 Positive Impacts
- Improved traceability from file+line to related commits, PRs, issues, and ADRs
- More efficient trace history queries
- Clearer and more consistent data model
- Better support for the hover feature
- Simplified build manifest
4.2 Negative Impacts
- Minor breaking changes to existing code
- Need to update any code that depends on the current model
- Slight increase in database size due to additional File nodes
5 · Decision
We will implement the proposed changes to the data model:- Add a
FileNode
class to represent files in the repository - Rename
created_at
tots
for consistency - Make
title
andbody
optional with default values - Ensure consistent edge direction across all relationship types
- Simplify the build manifest structure
6 · Implementation Checklist
- Update
NodeType
enum to includeFILE
- Add
FileNode
class - Rename
created_at
tots
inNode
base class - Make
title
andbody
optional with default values - Update all node subclasses to use the new field names
- Ensure all edge creation follows the consistent direction standard
- Simplify the
BuildManifest
model - Update database operations to handle File nodes
- Update ingestion logic to create File nodes
- Update tests to reflect the new model