
Bunnitar
Introduction: The Challenge of Context in AI Development
In the fast-paced world of AI-assisted software development, we faced a critical challenge: how do we provide Claude, our AI pair programmer, with the comprehensive context needed to truly understand our codebase? Random file searches and disconnected documentation simply weren’t cutting it. Claude could write code, but it couldn’t grasp the deeper why behind our features or the complex relationships between components.
This article details our journey of building a revolutionary SQLite-based task system that transformed how we work with Claude Code. We’ll dive deep into its architecture, share real examples from our implementation, and reveal how this system dramatically improved our development velocity while producing higher quality code.
The Journey: From Fragmented Tools to Integrated System
Before our SQLite task system, our development process looked like many others:
- Scattered documentation across multiple markdown files
- Task tracking in separate systems disconnected from code
- No clear way to show Claude the relationships between features
- Constant context switching for developers
- Knowledge siloed within individual team members
We needed a solution that would not only organize our work but also provide Claude with the rich, structured context it needed to truly understand our project. The breakthrough came when we realized we could leverage SQLite—a lightweight, file-based database—to create a comprehensive knowledge system that tied everything together.
System Architecture: A Database That Thinks Like a Developer
Our SQLite task system is built around a hierarchical structure that mirrors how developers naturally think about their work:
Plans and Tasks: The Project Backbone
At the highest level, we organize work into Plans—strategic initiatives like “SSE Implementation” or “VNC Desktop Feature.” Each plan contains multiple Tasks that represent concrete implementation work.
For example, our “VNC Desktop” plan included tasks like:
- Base Installation (XFCE desktop and x11vnc server)
- Security Hardening (SSL certificates and firewall rules)
- Service Configuration (systemd integration and auto-restart)
- Documentation & Optimization
Each of these entities is tracked in our items
table with relationships that establish a clear hierarchy:
CREATE TABLE items (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
type TEXT NOT NULL, -- 'plan' or 'task'
parent_id INTEGER, -- for hierarchy within same type
description TEXT,
status TEXT NOT NULL DEFAULT 'active',
priority INTEGER NOT NULL DEFAULT 0,
assigned_to TEXT,
due_date DATETIME,
completion_date DATETIME,
created_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
start_commit TEXT,
end_commit TEXT,
FOREIGN KEY (parent_id) REFERENCES items (id),
UNIQUE (name, parent_id, type)
);
Features: The Building Blocks
Within both plans and tasks, we track individual Features—the atomic units of functionality that make up our system. What makes our approach unique is how we establish relationships between plan features (requirements) and task features (implementations).
CREATE TABLE features (
id INTEGER PRIMARY KEY AUTOINCREMENT,
item_id INTEGER NOT NULL,
name TEXT NOT NULL,
description TEXT,
status TEXT NOT NULL DEFAULT 'not_started',
created_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (item_id) REFERENCES items (id),
UNIQUE (item_id, name)
);
CREATE TABLE feature_mappings (
plan_feature_id INTEGER NOT NULL,
task_feature_id INTEGER NOT NULL,
PRIMARY KEY (plan_feature_id, task_feature_id),
FOREIGN KEY (plan_feature_id) REFERENCES features (id),
FOREIGN KEY (task_feature_id) REFERENCES features (id)
);
This mapping allows us to track which implementation satisfies which requirement—critical context for Claude when implementing or modifying code.
Documentation Resources: Preserving Knowledge
Perhaps the most important aspect of our system is how it preserves the rich knowledge contained in our markdown documentation files:
CREATE TABLE document_resources (
id INTEGER PRIMARY KEY AUTOINCREMENT,
item_id INTEGER,
feature_id INTEGER,
resource_type TEXT NOT NULL,
filename TEXT NOT NULL,
content TEXT NOT NULL,
language TEXT,
created_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (item_id) REFERENCES items (id),
FOREIGN KEY (feature_id) REFERENCES features (id)
);
This table stores markdown content, code samples, and even file paths, ensuring that all context is preserved and linked to the appropriate tasks and features.
The Magic of Clood Groups: Automated Documentation from Code
One of our most innovative features is the “Clood Group” system, which reverse-engineers documentation from actual code changes:
CREATE TABLE clood_groups (
id INTEGER PRIMARY KEY AUTOINCREMENT,
item_id INTEGER NOT NULL,
feature_id INTEGER,
file_path TEXT NOT NULL,
prompt_content TEXT NOT NULL,
files_included TEXT, -- JSON array of file paths
created_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
status TEXT NOT NULL DEFAULT 'generated',
start_commit TEXT,
end_commit TEXT,
FOREIGN KEY (item_id) REFERENCES items (id),
FOREIGN KEY (feature_id) REFERENCES features (id)
);
When a task is completed, our system:
- Analyzes the git diff between the start and end commits
- Identifies which files were changed and how
- Generates a “prompt” that would recreate these changes
- Creates a JSON file with this information
For example, a Clood Group for our task progress component looks like this:
{
"files": [
"Neuro.Client/components/Tasks/TaskProgress.vue",
"Neuro.Client/composables/useTaskUpdates.ts"
],
"prompt": "Create a TaskProgress component that displays a progress bar for long-running tasks. It should subscribe to SSE notifications using the useTaskUpdates composable to receive real-time progress updates. The component should show percentage complete, estimated time remaining, and current status."
}
This approach creates a virtuous cycle of documentation: as we build features, we automatically generate the prompts that would recreate them, providing Claude with perfect examples of how to implement similar features in the future.
Real-World Example: The VNC Desktop Implementation
To illustrate how our system works in practice, let’s examine how we implemented a shared Ubuntu desktop environment accessible via VNC:
1. Plan Definition
We began by creating a “VNC Desktop Feature” plan in our database with clear requirements:
- Desktop Environment (Ubuntu with XFCE)
- VNC Server (multi-user, persistent sessions)
- Accessibility (standard clients, web access)
- Security (password protection, encryption)
- Performance optimizations
2. Task Breakdown
We broke this down into four concrete tasks, each with their own checklist of features:
- Base Installation (XFCE desktop and x11vnc server)
- Security Hardening (SSL certificates and firewall rules)
- Service Configuration (systemd integration and auto-restart)
- Documentation & Optimization
3. Implementation and Tracking
As we implemented each task, we tracked our progress in the database and linked each feature to the specific git commits that implemented it. This allowed us to see in real-time how the project was progressing.
4. Clood Group Generation
Upon completing each task, our system automatically generated Clood Groups that captured the essence of our changes. For example, the service configuration task produced a Clood Group that detailed:
- The systemd service file we created
- The monitoring scripts we implemented
- The auto-restart logic we added
- The prompt that would regenerate these files
5. Context for Future Work
Later, when we needed to make changes to the VNC system, Claude had perfect context: it could see the original requirements, how they mapped to implementations, the actual code changes made, and even the reasoning behind those changes.
How This Transformed Our Work with Claude
The impact of our SQLite task system on our work with Claude Code has been transformative:
1. Structured Context for AI Understanding
Instead of providing Claude with random file snippets, we can now give it structured context that includes:
- The high-level purpose of a feature
- How it relates to other components
- The specific requirements it needs to meet
- Examples of similar implementations
This dramatically improves Claude’s ability to generate relevant, high-quality code that follows our project patterns.
2. Reduced Context Switching
Developers no longer need to jump between different systems to understand tasks, requirements, and documentation—everything is integrated in one place, accessible through SQL queries.
3. Knowledge Preservation
As team members come and go, their knowledge is preserved in the system through documentation resources and Clood Groups, ensuring continuity and reducing the learning curve for new members.
4. Automated Documentation
The Clood Group generation system ensures that our documentation stays in sync with our code, reducing the typically tedious process of maintaining technical docs.
5. Quality Metrics
We can now track completion rates, feature status, and even generate reports on our development velocity—all from the same system that helps us write better code.
Technical Implementation Details
Database Initialization
We initialize our database with a simple shell script that creates all tables and sets up basic settings:
#!/bin/bash
# Initialize SQLite database
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
DB_FILE="${SCRIPT_DIR}/../db/sql.db"
# Create database file if it doesn't exist
mkdir -p "$(dirname "$DB_FILE")"
touch "$DB_FILE"
# Run SQL schema creation script
sqlite3 "$DB_FILE" < "${SCRIPT_DIR}/create_tables.sql"
echo "Database initialized at $DB_FILE"
Example Queries for Development
Our system supports powerful queries that help developers understand the project status and relationships:
Project Overview
SELECT i.name, i.type, i.status, COUNT(f.id) as features,
SUM(CASE WHEN f.status = 'completed' THEN 1 ELSE 0 END) as completed
FROM items i LEFT JOIN features f ON i.id = f.item_id
GROUP BY i.id;
Finding Related Implementations
SELECT pf.name as plan_feature, tf.name as task_feature, i.name as task
FROM feature_mappings fm
JOIN features pf ON fm.plan_feature_id = pf.id
JOIN features tf ON fm.task_feature_id = tf.id
JOIN items i ON tf.item_id = i.id
WHERE pf.name LIKE '%desktop%';
Documentation Search
SELECT dr.filename, dr.content
FROM document_resources dr
JOIN items i ON dr.item_id = i.id
WHERE dr.content LIKE '%VNC%' AND i.status = 'completed';
Clood Group Generation Logic
The procedure for generating Clood Groups is stored directly in the database:
INSERT INTO clood_group_generation_procedures (name, description, steps)
VALUES (
'reverse_engineer_prompt',
'Generate a clood group prompt by analyzing git repository changes',
'[
{"step": 1, "action": "get_modified_files", "command": "git diff --name-status {start_commit} {end_commit}"},
{"step": 2, "action": "analyze_file_changes", "command": "git diff {start_commit} {end_commit} {file_path}"},
{"step": 3, "action": "extract_key_features", "description": "Extract main features and functionalities added"},
{"step": 4, "action": "generate_prompt", "description": "Generate a prompt that would recreate the changes"},
{"step": 5, "action": "create_json_file", "template": {"files": "{files_array}", "prompt": "{generated_prompt}"}}
]'
);
Lessons Learned
Building this system has taught us several valuable lessons about AI-assisted development:
1. Structure Matters More Than Volume
The quality of context matters far more than quantity. Structured, relationship-rich information helps Claude understand our system better than dumping thousands of lines of code.
2. Document the Why, Not Just the What
By preserving the reasoning behind our changes through Clood Groups, we enable Claude to understand our design decisions, not just our code patterns.
3. Automation Creates Consistency
Automating documentation through Clood Groups ensures that our docs stay in sync with our code, creating a single source of truth.
4. Git Integration is Essential
By linking our plans and tasks to specific commits, we create a complete picture of how our project has evolved over time.
5. SQL is a Perfect Fit
The relational nature of SQL makes it ideal for tracking the complex web of relationships in a software project, while SQLite's file-based approach keeps everything simple to deploy and maintain.
Future Directions
As we continue to evolve our system, several exciting possibilities are on the horizon:
Enhanced Context Preservation
We're working on extending Clood Groups to capture more nuanced aspects of development, such as design discussions, alternatives considered, and performance tradeoffs.
Intelligent Task Prioritization
By analyzing task dependencies and feature relationships, we can potentially use AI to suggest optimal task sequencing and identify critical paths in our development workflow.
Adaptive Documentation
We envision documentation that evolves automatically as code changes, using the Clood Group system to detect when implementations drift from their original design and updating accordingly.
Workflow Optimization
By analyzing patterns in our development process, we can identify bottlenecks and suggest process improvements to increase velocity without sacrificing quality.
Conclusion: A New Paradigm for AI-Assisted Development
Our SQLite task system represents more than just an organizational tool—it's a fundamental shift in how we approach AI-assisted development. By providing Claude with structured, relationship-rich context, we've transformed it from a clever code generator into a true development partner that understands the deeper purpose of our software.
The results speak for themselves: faster development, higher quality code, better knowledge preservation, and a more seamless collaboration between human developers and AI assistants.
As AI code assistants continue to evolve, systems like ours will play an increasingly important role in maximizing their effectiveness. The future of software development isn't just about better AI models—it's about creating the infrastructure that allows those models to truly understand our projects at a deep level.
By sharing our approach, we hope to inspire others to explore how structured context can transform their own AI-assisted development workflows and unlock the full potential of tools like Claude Code.