From 4b72e6fc2e88273217954fb06ace42dd2a1f09a2 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 27 Dec 2025 10:11:56 -0500 Subject: [PATCH] refactor(worklog): consolidate git commands into script - Move all git context gathering into extract-metrics.sh - Script now outputs: branch, status, commits, files, lines - Remove redundant Helper Scripts entry - Semantic compression refs already removed in previous commit 98 -> 88 lines (-10%) --- .beads/issues.jsonl | 4 ++-- skills/worklog/SKILL.md | 24 +++++++---------------- skills/worklog/scripts/extract-metrics.sh | 21 ++++++++++++++++++-- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 2f4adf4..c44f07e 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -70,7 +70,7 @@ {"id":"skills-hh2","title":"skill: rename_symbol with LSP + validation","description":"Skill that performs safe renames:\n1. Uses LSP textDocument/rename\n2. Runs formatters\n3. Checks LSP diagnostics post-rename\n4. Opens bead if errors remain\n5. Updates doc references using hover/signatureHelp\n\nInput: new name, scope. Output: clean rename or bead with issues.","status":"open","priority":3,"issue_type":"task","created_at":"2025-12-24T02:29:56.87156069-05:00","updated_at":"2025-12-24T02:29:56.87156069-05:00","dependencies":[{"issue_id":"skills-hh2","depends_on_id":"skills-gga","type":"blocks","created_at":"2025-12-24T02:30:06.583813579-05:00","created_by":"daemon"}]} {"id":"skills-hin","title":"ADR: Skills and Molecules Integration Design","description":"Write Architecture Decision Record documenting:\n- Current state (skills via Nix/direnv, molecules via beads)\n- Decision to link via skill: references\n- Wisp trace format spec\n- Elevation pipeline design\n- Anti-patterns to avoid\n\nLocation: docs/adr/001-skills-molecules-integration.md\n\nMigrated from dotfiles-dn8 (was in_progress).\n\n## Current State\n- ADR-001 drafted (high-level integration)\n- ADR-002, 003, 004 drafted and revised (manifest, versioning, security)\n- Orch consensus feedback incorporated\n\n## Parked\nDeferring finalization until we see Steve Yegge's new orchestration work and how it might inform our design.","status":"open","priority":2,"issue_type":"task","created_at":"2025-12-23T19:20:47.568903148-05:00","updated_at":"2025-12-24T02:41:40.676399328-05:00"} {"id":"skills-idb","title":"Handle concurrency and multi-agent execution","description":"Not addressed in ADR. Questions:\n\n- What happens when two agents run same skill on same mol step?\n- How to handle partial failures and resumptions?\n- Trace merging: append-only log vs latest-wins?\n\nNeeds:\n- execution_id and parent_execution_id in traces\n- Step completion idempotency declaration\n- Define how multiple traces attach to one mol node\n\nCan defer until basic integration works.","status":"open","priority":4,"issue_type":"task","created_at":"2025-12-23T19:49:59.608603168-05:00","updated_at":"2025-12-23T19:49:59.608603168-05:00"} -{"id":"skills-j2a","title":"worklog: consolidate git commands into extract-metrics.sh","description":"Context Gathering section has raw git commands, but extract-metrics.sh also exists. Feature envy - split logic. Move all git context gathering into the script, skill makes single call. Found by smells lens review.","status":"open","priority":3,"issue_type":"task","created_at":"2025-12-25T02:03:16.478103649-05:00","updated_at":"2025-12-25T02:03:16.478103649-05:00"} +{"id":"skills-j2a","title":"worklog: consolidate git commands into extract-metrics.sh","description":"Context Gathering section has raw git commands, but extract-metrics.sh also exists. Feature envy - split logic. Move all git context gathering into the script, skill makes single call. Found by smells lens review.","status":"closed","priority":3,"issue_type":"task","created_at":"2025-12-25T02:03:16.478103649-05:00","updated_at":"2025-12-27T10:11:48.158176684-05:00","closed_at":"2025-12-27T10:11:48.158176684-05:00","close_reason":"Closed"} {"id":"skills-jbo","title":"Skills: verify symbols via LSP before suggesting","description":"Inversion: let LSP answer facts, let models answer strategy.\n\nBefore Claude suggests using a function/type:\n- Verify existence via workspace/symbol or go-to-definition\n- If not found, propose alternatives that ARE found\n- Gather definition, references, inferred types, diagnostics as context\n\nReduces hallucinated APIs and grounds patches in reality.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-12-24T02:29:56.391182872-05:00","updated_at":"2025-12-24T02:29:56.391182872-05:00","dependencies":[{"issue_id":"skills-jbo","depends_on_id":"skills-gga","type":"blocks","created_at":"2025-12-24T02:30:06.529604354-05:00","created_by":"daemon"}]} {"id":"skills-jeb","title":"Define wisp execution trace format","description":"Design structured format for skill execution traces in wisps:\n- skill_version (git SHA + flake hash)\n- inputs (context refs, env vars)\n- tool_calls [{cmd, args, exit_code, duration}]\n- checkpoints [{step, summary, timestamp}]\n- outputs (file diffs or refs)\n\nEnable: replay, diff traces, regression testing\n\nMigrated from dotfiles-ub9.","status":"open","priority":2,"issue_type":"task","created_at":"2025-12-23T19:20:57.896088397-05:00","updated_at":"2025-12-23T19:20:57.896088397-05:00","dependencies":[{"issue_id":"skills-jeb","depends_on_id":"skills-hin","type":"blocks","created_at":"2025-12-23T19:21:39.588011474-05:00","created_by":"dan"},{"issue_id":"skills-jeb","depends_on_id":"skills-gq9","type":"blocks","created_at":"2025-12-23T19:50:10.069841366-05:00","created_by":"daemon"},{"issue_id":"skills-jeb","depends_on_id":"skills-be3","type":"blocks","created_at":"2025-12-23T19:50:10.117400312-05:00","created_by":"daemon"},{"issue_id":"skills-jeb","depends_on_id":"skills-ty7","type":"blocks","created_at":"2025-12-23T19:50:10.163656807-05:00","created_by":"daemon"},{"issue_id":"skills-jeb","depends_on_id":"skills-6gw","type":"blocks","created_at":"2025-12-23T19:50:10.202702536-05:00","created_by":"daemon"}]} {"id":"skills-kg7","title":"Desktop automation for Wayland/niri","description":"Explore and implement desktop automation solutions for Wayland (niri compositor).\n\n## The Seeing Problem\n\nHow can an AI agent understand what's on screen?\n\n### Layers (bottom to top)\n1. **Window awareness** - what's open, app_id, title → niri IPC ✅\n2. **Window geometry** - size, position, monitor → niri IPC ✅\n3. **Pixel capture** - screenshots → niri screenshot-window ✅\n4. **Understanding** - UI elements, coordinates, semantics → **GAP**\n\n### Two paths to understanding (layer 4)\n\n**Path A: AT-SPI (structured)**\n- Pros: precise coordinates, semantic element types, states\n- Cons: runtime overhead, requires NixOS config, app compliance varies\n- Coverage: GTK ✅, Qt (with env var), Electron ❓\n\n**Path B: Vision model (visual)**\n- Pros: universal (works on any pixels), no system config needed\n- Cons: API latency, token cost, coordinate precision unclear\n- Coverage: anything visible ✅\n\n### Hybrid approach\nRun both, benchmark tradeoffs:\n- AT-SPI overhead vs query precision\n- Vision model latency/cost vs coverage\n- When to use which (or both for validation)\n\n## What we have\n- niri-window-capture skill (screenshots, window list)\n- niri IPC for window/monitor geometry\n\n## Context\nWayland's security model blocks X11-style automation. Solutions require:\n- Compositor-specific IPC (niri msg)\n- App opt-in via AT-SPI accessibility\n- Or vision model interpretation of pixels","status":"open","priority":2,"issue_type":"epic","created_at":"2025-12-17T12:42:17.863074501-08:00","updated_at":"2025-12-17T14:12:59.143207802-08:00","dependencies":[{"issue_id":"skills-kg7","depends_on_id":"skills-pdg","type":"blocks","created_at":"2025-12-17T13:59:59.915105471-08:00","created_by":"daemon","metadata":"{}"},{"issue_id":"skills-kg7","depends_on_id":"skills-ebl","type":"blocks","created_at":"2025-12-17T14:13:41.679692009-08:00","created_by":"daemon","metadata":"{}"},{"issue_id":"skills-kg7","depends_on_id":"skills-bww","type":"blocks","created_at":"2025-12-17T14:13:41.725196677-08:00","created_by":"daemon","metadata":"{}"}]} @@ -81,7 +81,7 @@ {"id":"skills-lzk","title":"Simplify branch name generation in create-new-feature.sh","description":"File: .specify/scripts/bash/create-new-feature.sh (lines 137-181)\n\nIssues:\n- 3 nested loops/conditionals\n- Complex string transformations with multiple sed operations\n- Stop-words list and filtering logic hard to maintain\n\nFix:\n- Extract to separate function\n- Simplify word filtering logic\n- Add input validation\n\nSeverity: MEDIUM","status":"open","priority":3,"issue_type":"task","created_at":"2025-12-24T02:51:14.286951249-05:00","updated_at":"2025-12-24T02:51:14.286951249-05:00"} {"id":"skills-m21","title":"Apply niri-window-capture code review recommendations","description":"CODE-REVIEW-niri-window-capture.md identifies action items: add dependency checks to scripts, improve error handling for niri failures, add screenshot directory validation, implement rate limiting. See High/Medium priority sections.","status":"open","priority":2,"issue_type":"task","created_at":"2025-11-30T11:58:24.648846875-08:00","updated_at":"2025-11-30T11:58:24.648846875-08:00"} {"id":"skills-mx3","title":"spec-review: Define consensus thresholds and decision rules","description":"'Use judgment' for mixed results leads to inconsistent decisions.\n\nDefine:\n- What constitutes consensus (2/3? unanimous?)\n- How to handle NEUTRAL votes\n- Tie-break rules\n- When human override is acceptable and how to document it","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-15T00:23:24.121175736-08:00","updated_at":"2025-12-15T13:58:04.339283238-08:00","closed_at":"2025-12-15T13:58:04.339283238-08:00"} -{"id":"skills-njb","title":"worklog: clarify or remove semantic compression references","description":"SKILL.md references 'semantic compression is a planned workflow' multiple times but it's not implemented. Speculative generality - adds cognitive load for non-existent feature. Either implement or move to design notes. Found by smells lens review.","status":"open","priority":4,"issue_type":"task","created_at":"2025-12-25T02:03:25.387405002-05:00","updated_at":"2025-12-25T02:03:25.387405002-05:00"} +{"id":"skills-njb","title":"worklog: clarify or remove semantic compression references","description":"SKILL.md references 'semantic compression is a planned workflow' multiple times but it's not implemented. Speculative generality - adds cognitive load for non-existent feature. Either implement or move to design notes. Found by smells lens review.","status":"closed","priority":4,"issue_type":"task","created_at":"2025-12-25T02:03:25.387405002-05:00","updated_at":"2025-12-27T10:11:48.169923742-05:00","closed_at":"2025-12-27T10:11:48.169923742-05:00","close_reason":"Closed"} {"id":"skills-oes","title":"Define skill manifest format","description":"Skills need to declare their interface so beads can validate.\n\nManifest should include:\n- Required inputs (args, env vars)\n- Optional inputs with defaults\n- Expected outputs (files, artifacts)\n- Preconditions (tools, repos, permissions)\n\nLocation: SKILL.md frontmatter or separate manifest.yaml\n\nEnables: Proto validation before spawning, better error messages.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-23T19:49:30.673372413-05:00","updated_at":"2025-12-23T20:55:04.427620449-05:00","closed_at":"2025-12-23T20:55:04.427620449-05:00","close_reason":"ADRs revised with orch consensus feedback"} {"id":"skills-p2o","title":"Refactor update-agent-context.sh: array+loop for agents","description":"File: .specify/scripts/bash/update-agent-context.sh (772 lines)\n\nIssues:\n- 12 nearly-identical if-blocks in update_all_existing_agents() (lines 632-701)\n- Should be refactored into loop with array of agent configurations\n- Current pattern repeats: if [[ -f \"$CLAUDE_FILE\" ]]; then update_agent_file...\n\nFix:\n- Create AGENTS array with (file, name, format) tuples\n- Replace 12 if-blocks with single for loop\n- Estimated reduction: 60 lines\n\nSeverity: HIGH","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-24T02:50:57.385820971-05:00","updated_at":"2025-12-25T01:44:58.370191619-05:00","closed_at":"2025-12-25T01:44:58.370191619-05:00","close_reason":"update-agent-context.sh is .specify upstream code, not maintained here"} {"id":"skills-p3v","title":"Cross-language FFI wormholes via LSP","description":"Bridge FFI boundaries where standard LSPs go blind:\n- Rust extern C → clangd lookup\n- Go CGO → match C symbols\n- Python FFI → trace bindings\n\nGenerate synthetic go-to-definition maps. When hovering over C call in Rust, intercept hover request, query C LSP, inject C definition into Rust tooltip.\n\nEnables seamless polyglot navigation.","status":"open","priority":4,"issue_type":"feature","created_at":"2025-12-24T02:29:57.597602745-05:00","updated_at":"2025-12-24T02:29:57.597602745-05:00"} diff --git a/skills/worklog/SKILL.md b/skills/worklog/SKILL.md index c939e19..5708eb1 100644 --- a/skills/worklog/SKILL.md +++ b/skills/worklog/SKILL.md @@ -20,17 +20,13 @@ Invoke this skill when the user requests: ## Context Gathering -Before writing the worklog, gather the following context using the Bash tool: +Before writing the worklog, run the metrics script to gather git context: -**Git Information:** -- Current git status: `git status` -- Current date and time: `date` -- Recent commits: `git log --oneline -10` -- Active branch: `git branch --show-current` -- Uncommitted changes: `git diff --stat` +```bash +scripts/extract-metrics.sh +``` -**Session Metrics:** -Use the helper script to extract metrics (see Helper Scripts section below) +This outputs: branch, uncommitted changes, commits today, files touched, lines added/removed, and recent commit messages. ## File Location @@ -51,12 +47,6 @@ The template defines all required sections. Parse it directly rather than relyin ## Helper Scripts -**Extract Git Metrics:** -```bash -scripts/extract-metrics.sh -``` -Outputs: commits made, files touched, lines added/removed - **Suggest Filename:** ```bash scripts/suggest-filename.sh @@ -81,8 +71,8 @@ Searches previous worklogs for context continuity ## Process -1. Gather git context using the Bash tool with commands shown above -2. Run helper scripts to extract metrics and suggest filename +1. Run `scripts/extract-metrics.sh` to gather git context +2. Run `scripts/suggest-filename.sh` to get filename suggestion 3. Read the complete template from `templates/worklog-template.org` 4. Search for related previous worklogs using the find-related-logs script 5. Fill in all template sections with detailed information from the session diff --git a/skills/worklog/scripts/extract-metrics.sh b/skills/worklog/scripts/extract-metrics.sh index f7650e8..9623d36 100755 --- a/skills/worklog/scripts/extract-metrics.sh +++ b/skills/worklog/scripts/extract-metrics.sh @@ -48,14 +48,31 @@ fi # Get recent commit messages RECENT_COMMITS=$(git log --since="$TODAY 00:00:00" --oneline | head -10) +# Get branch and status info +BRANCH=$(git branch --show-current 2>/dev/null || echo "detached") +STATUS=$(git status --short 2>/dev/null) +UNCOMMITTED=$(echo "$STATUS" | wc -l | tr -d ' ') +if [ -z "$STATUS" ]; then + UNCOMMITTED=0 +fi + # Output structured data cat <