Work-Wiki as Upper Concept of Git
The Problem with Traditional Git
Copy
┌─────────────────────────────────────────────────────────────────────────────────┐
│ THE PROBLEM: GIT ONLY SEES COMMITS │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ Traditional Git timeline: │
│ │
│ ●─────────────────────●─────────────────────● │
│ commit commit commit │
│ abc123 def456 ghi789 │
│ │
│ What ACTUALLY happened between commits: │
│ │
│ ●───○──○──○──○──○────●───○──○──○──○──○────● │
│ commit save save commit save save commit │
│ (AI) (Human) (AI) (Human) │
│ │
│ Legend: │
│ ● = Git commit (visible to Git) │
│ ○ = File save (INVISIBLE to Git) │
│ │
│ Traditional Git loses: │
│ X Who made each intermediate change │
│ X When changes were made (only commit time) │
│ X AI vs Human distinction │
│ X The progression of development │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
Work-Wiki-Diff Solution
Copy
┌─────────────────────────────────────────────────────────────────────────────────┐
│ WORK-WIKI-DIFF: CAPTURING MICRO-SAVES │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ Work-Wiki operates ABOVE Git: │
│ │
│ WORK-WIKI LAYER (Upper Concept) │
│ │
│ ○───○───○───○───○───○───○───○───○───○───○───○ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ ├───┼───┘ │ │ ├───┼───┘ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ 5 saves │ │ 4 saves │ │ 3 saves │ │
│ │ --> commit A│ │ --> commit B│ │ --> commit C│ │
│ │ (3 AI, 2 H) │ │ (1 AI, 3 H) │ │ (0 AI, 3 H) │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │ │
│ ═══════╪════════════════╪════════════════╪═════════════════════════ │
│ │ │ │ │
│ GIT LAYER (Commits Only) │
│ │
│ ●────────────────●────────────────● │
│ commit A commit B commit C │
│ abc123 def456 ghi789 │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
- Every save event with timestamp
- ai_session_id (which AI session)
- agent_name (Claude, Gemini, Copilot, etc.)
- committed_hash (which commit absorbed this save)
- parent_hash (what HEAD was at save time)
Database Schema V2
Copy
┌─────────────────────────────────────────────────────────────────────────────────┐
│ WORK-WIKI-DIFF DATABASE SCHEMA V2 │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ file_diffs (Core Table - V1 + V2 columns) │ │
│ ├─────────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ Column Type Constraints Index │ │
│ │ ─────────────────────────────────────────────────────────────────────│ │
│ │ id INTEGER PK, AUTOINCREMENT - │ │
│ │ ts INTEGER NOT NULL idx_ts │ │
│ │ abs_path TEXT NOT NULL idx_path │ │
│ │ rel_path TEXT - - │ │
│ │ git_repo_path TEXT NOT NULL idx_repo │ │
│ │ head_hash TEXT NOT NULL idx_head │ │
│ │ diff_content TEXT - - │ │
│ │ additions INTEGER DEFAULT 0 - │ │
│ │ deletions INTEGER DEFAULT 0 - │ │
│ │ ──────── V2 columns (Human ◈ AI Transparency) ───────────────────── │ │
│ │ committed_hash TEXT NULL=uncommitted idx_committed │ │
│ │ parent_hash TEXT - - │ │
│ │ change_type TEXT DEFAULT 'save' idx_change_type │ │
│ │ ai_session_id TEXT - idx_session │ │
│ │ agent_name TEXT - - │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ │ ai_session_id (FK) │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ ai_sessions (AI Session Tracking) │ │
│ ├─────────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ id TEXT PK (session identifier) │ │
│ │ agent_name TEXT "Claude", "Copilot", etc. │ │
│ │ model_id TEXT "claude-3-opus", etc. │ │
│ │ started_at INTEGER Session start timestamp │ │
│ │ ended_at INTEGER Session end timestamp │ │
│ │ terminal_id TEXT Which terminal tab │ │
│ │ repo_path TEXT Repository context │ │
│ │ total_saves INTEGER Running count of saves │ │
│ │ total_additions INTEGER Cumulative lines added │ │
│ │ total_deletions INTEGER Cumulative lines deleted │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ commit_work_mapping (Links saves to commits) │ │
│ ├─────────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ commit_hash TEXT PK (composite), Git commit SHA │ │
│ │ diff_id INTEGER PK, FK to file_diffs.id │ │
│ │ repo_path TEXT Repository path │ │
│ │ linked_at INTEGER When link was created │ │
│ │ │ │
│ │ Relationship: Many saves (diff_id) --> One commit (commit_hash) │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
V1 vs V2 Fields
Copy
┌─────────────────────────────────────────────────────────────────────────────────┐
│ DIFFENTRY: V1 vs V2 FIELDS │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ V1 Fields (Original Diff Tracking): │
│ │
│ ┌─────────────────┬────────────────────────────────────────────────────────┐ │
│ │ Field │ Description │ │
│ ├─────────────────┼────────────────────────────────────────────────────────┤ │
│ │ id │ Primary key, auto-increment │ │
│ │ ts │ Unix timestamp of save event │ │
│ │ abs_path │ /Users/dev/project/src/auth.ts │ │
│ │ rel_path │ src/auth.ts (relative to repo root) │ │
│ │ head_hash │ abc123def456... (HEAD at save time) │ │
│ │ diff_content │ @@ -1,5 +1,8 @@\n+import...\n... │ │
│ │ additions │ 25 (lines added) │ │
│ │ deletions │ 3 (lines removed) │ │
│ └─────────────────┴────────────────────────────────────────────────────────┘ │
│ │
│ V2 Fields (Work-Wiki Extension for Human ◈ AI Transparency): │
│ │
│ ┌─────────────────┬────────────────────────────────────────────────────────┐ │
│ │ Field │ Description │ │
│ ├─────────────────┼────────────────────────────────────────────────────────┤ │
│ │ committed_hash │ def456ghi789... (commit that absorbed this diff) │ │
│ │ │ NULL = uncommitted (draft state) │ │
│ ├─────────────────┼────────────────────────────────────────────────────────┤ │
│ │ parent_hash │ Previous HEAD this file was saved against │ │
│ ├─────────────────┼────────────────────────────────────────────────────────┤ │
│ │ change_type │ "save" (default), "commit", "revert" │ │
│ ├─────────────────┼────────────────────────────────────────────────────────┤ │
│ │ ai_session_id │ "session_abc123" or NULL │ │
│ │ │ NOT NULL = AI-generated change │ │
│ │ │ NULL = Human-made change │ │
│ ├─────────────────┼────────────────────────────────────────────────────────┤ │
│ │ agent_name │ "Claude", "Gemini", "Copilot" or NULL │ │
│ └─────────────────┴────────────────────────────────────────────────────────┘ │
│ │
│ KEY INSIGHT: │
│ │
│ committed_hash IS NULL --> Uncommitted save (draft) │
│ committed_hash IS NOT NULL --> Linked to a commit │
│ │
│ ai_session_id IS NOT NULL --> AI-generated change (trackable) │
│ ai_session_id IS NULL --> Human-made change │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
The Six Work-Wiki Commands
Copy
┌─────────────────────────────────────────────────────────────────────────────────┐
│ 6 WORK-WIKI TAURI COMMANDS │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ CAPTURE │
│ │
│ (1) work_wiki_record_with_ai_context │
│ Purpose: Record file save with AI attribution │
│ Input: file_path, ai_session_id?, agent_name? │
│ Output: Option<i64> (inserted row ID) │
│ └─-> INSERT into file_diffs with V2 fields │
│ │
│ LINK │
│ │
│ (2) work_wiki_link_to_commit │
│ Purpose: Link uncommitted saves to a new commit │
│ Input: repo_path, commit_hash, parent_commit_hash │
│ Output: i32 (number of saves linked) │
│ └─-> UPDATE file_diffs SET committed_hash = ? │
│ INSERT INTO commit_work_mapping │
│ │
│ QUERY │
│ │
│ (3) work_wiki_get_pre_commit_changes │
│ Purpose: Get all saves that went into a commit │
│ Input: repo_path, commit_hash │
│ Output: PreCommitWork (diffs, human_saves, ai_saves, etc.) │
│ └─-> SELECT from file_diffs JOIN commit_work_mapping │
│ │
│ (4) work_wiki_get_ai_attribution │
│ Purpose: Calculate Human vs AI contribution percentage │
│ Input: repo_path, commit_hash? │
│ Output: AiAttribution (human_%, ai_%, agents breakdown) │
│ └─-> SUM with CASE WHEN ai_session_id IS NULL / NOT NULL │
│ │
│ (5) work_wiki_draft_branch_preview │
│ Purpose: Show uncommitted (draft) changes │
│ Input: repo_path │
│ Output: DraftBranchPreview (files, adds, dels, ai vs human) │
│ └─-> SELECT WHERE committed_hash IS NULL │
│ │
│ (6) work_wiki_get_commit_work_counts │
│ Purpose: Get micro-save counts for commit graph badges │
│ Input: repo_path, commit_hashes[] │
│ Output: HashMap<commit_hash, count> │
│ └─-> COUNT from commit_work_mapping for each hash │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
Key Query Patterns
Copy
┌─────────────────────────────────────────────────────────────────────────────────┐
│ KEY QUERY PATTERNS FOR HUMAN ◈ AI TRANSPARENCY │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ Pattern 1: Find Uncommitted (Draft) Saves │
│ │
│ SELECT * FROM file_diffs │
│ WHERE git_repo_path = ? │
│ AND committed_hash IS NULL <-- KEY: NULL means not yet committed │
│ │
│ Used by: work_wiki_draft_branch_preview() │
│ │
│ ────────────────────────────────────────────────────────────────────────── │
│ │
│ Pattern 2: Link Saves to Commit │
│ │
│ UPDATE file_diffs SET committed_hash = ? │
│ WHERE git_repo_path = ? │
│ AND head_hash = ? <-- Match saves made against parent commit │
│ AND committed_hash IS NULL <-- Only uncommitted saves │
│ │
│ Used by: work_wiki_link_to_commit() │
│ │
│ ────────────────────────────────────────────────────────────────────────── │
│ │
│ Pattern 3: AI vs Human Attribution (Single-Pass Aggregation) │
│ │
│ SELECT │
│ SUM(CASE WHEN ai_session_id IS NULL THEN additions ELSE 0 END) human_add, │
│ SUM(CASE WHEN ai_session_id IS NOT NULL THEN additions ELSE 0 END) ai_add │
│ FROM file_diffs fd │
│ JOIN commit_work_mapping cwm ON fd.id = cwm.diff_id │
│ WHERE cwm.commit_hash = ? │
│ │
│ KEY: CASE WHEN ai_session_id IS NULL --> Human │
│ CASE WHEN ai_session_id IS NOT NULL --> AI │
│ │
│ Used by: work_wiki_get_ai_attribution() │
│ │
│ ────────────────────────────────────────────────────────────────────────── │
│ │
│ Pattern 4: Multi-Agent Breakdown │
│ │
│ SELECT agent_name, SUM(additions), SUM(deletions) │
│ FROM file_diffs fd │
│ JOIN commit_work_mapping cwm ON fd.id = cwm.diff_id │
│ WHERE cwm.commit_hash = ? AND agent_name IS NOT NULL │
│ GROUP BY agent_name │
│ │
│ Output: Claude: +100 -20, Copilot: +20 -5, etc. │
│ │
│ Used by: work_wiki_get_ai_attribution() │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
AI Attribution Output
Copy
┌─────────────────────────────────────────────────────────────────────────────────┐
│ AI ATTRIBUTION OUTPUT │
├─────────────────────────────────────────────────────────────────────────────────┤
│ │
│ AiAttribution { │
│ human_additions: 45, │
│ human_deletions: 10, │
│ ai_additions: 120, │
│ ai_deletions: 25, │
│ human_percentage: 27.5, // (45+10) / (45+10+120+25) * 100 │
│ ai_percentage: 72.5, // (120+25) / (45+10+120+25) * 100 │
│ agents: [ │
│ AgentContribution { │
│ agent_name: "Claude", │
│ additions: 100, │
│ deletions: 20, │
│ percentage: 60.0, │
│ }, │
│ AgentContribution { │
│ agent_name: "Copilot", │
│ additions: 20, │
│ deletions: 5, │
│ percentage: 12.5, │
│ }, │
│ ] │
│ } │
│ │
│ Visual Representation: │
│ │
│ Human [########............................] 27.5% │
│ │
│ AI [........############################ 72.5% │
│ ├── Claude [####################..] 60.0% │
│ └── Copilot [####..................] 12.5% │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
THE CENTER
How Work-Wiki-Diff Serves THE CENTER
Transparency: Every save event recorded with AI attributionTraceability: committed_hash links micro-saves to Git commitsAttribution: Calculate human_% vs ai_% for any commitVisibility: Draft preview shows uncommitted AI workWithout Work-Wiki-Diff, AI contributions would be invisible.
With Work-Wiki-Diff, every keystroke is traceable.