Skip to content

Commit 75e7ace

Browse files
Merge pull request #88 from forecast-bio/feature/dev-config-cleanup
fix: dev config cleanup — hook infra, stale MCP, gitignore
2 parents 366191b + add5ab2 commit 75e7ace

22 files changed

Lines changed: 1611 additions & 1142 deletions

.claude/commands/audit.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
allowed-tools: Bash(crosslink *), Bash(git *), Bash(ls *), Read
3+
description: Full context dump for debugging — use when stuck or disoriented
4+
---
5+
6+
## Context
7+
8+
- Session status: !`crosslink session status`
9+
- Open issues: !`crosslink issue list -s open`
10+
- Active locks: !`crosslink locks list 2>/dev/null`
11+
- Current branch: !`git branch --show-current`
12+
- Working tree: !`git status --short`
13+
14+
## Your task
15+
16+
You are stuck, confused, or need to re-orient. This skill dumps all available context so you can diagnose the problem. Run through each section and print the results.
17+
18+
### 1. Project grounding (same as /preflight)
19+
20+
Read core rules:
21+
```
22+
Read .crosslink/rules/global.md
23+
```
24+
25+
Detect languages and read relevant rule files (check for `Cargo.toml`, `package.json`, `tsconfig.json`, `pyproject.toml`, `go.mod`, etc.).
26+
27+
Read project-specific rules:
28+
```
29+
Read .crosslink/rules/project.md
30+
```
31+
32+
Read tracking rules based on current mode:
33+
```bash
34+
crosslink config get tracking_mode
35+
```
36+
Then read `.crosslink/rules/tracking-<mode>.md`.
37+
38+
### 2. Project tree scan
39+
40+
```bash
41+
ls -1
42+
```
43+
44+
Scan the project tree (max depth 3, max 50 entries) to ground yourself on actual paths.
45+
46+
### 3. Dependency versions
47+
48+
Read the primary manifest file to confirm actual dependency versions.
49+
50+
### 4. Session state
51+
52+
```bash
53+
crosslink session status
54+
```
55+
56+
What issue are you working on? What was the last action?
57+
58+
### 5. Active issue details
59+
60+
If working on an issue, get full details:
61+
62+
```bash
63+
crosslink issue show <issue-id>
64+
```
65+
66+
Review all comments, especially plan and decision comments.
67+
68+
### 6. Related issues and blockers
69+
70+
```bash
71+
crosslink issue blocked
72+
crosslink issue ready
73+
```
74+
75+
Are there blocking dependencies? What's unblocked and available?
76+
77+
### 7. Lock state
78+
79+
```bash
80+
crosslink locks list 2>/dev/null
81+
```
82+
83+
Are any issues locked by other agents?
84+
85+
### 8. Recent interventions
86+
87+
Check if there have been recent hook blocks or driver redirects by reviewing recent issue comments.
88+
89+
### 9. Hook configuration
90+
91+
```bash
92+
crosslink config show
93+
```
94+
95+
What tracking mode is active? What commands are blocked/gated?
96+
97+
### 10. Git state
98+
99+
```bash
100+
git status
101+
git log --oneline -5
102+
git diff --stat HEAD
103+
```
104+
105+
What's the current branch state? Any uncommitted changes?
106+
107+
### 11. Print diagnostic summary
108+
109+
```
110+
Audit summary:
111+
Session: active / working on #<id>
112+
Branch: <branch>
113+
Tracking: <mode>
114+
Languages: <list>
115+
Open issues: <count>
116+
Blocked: <count>
117+
Locks: <count>
118+
Uncommitted: <count> files changed
119+
120+
Loaded rules: global.md, <lang>.md, tracking-<mode>.md, project.md
121+
```
122+
123+
You are now fully re-oriented. Decide your next action based on this context.

.claude/commands/check.md

Lines changed: 83 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,87 @@
11
---
2-
allowed-tools: Bash(tmux *), Bash(cat *), Bash(test *), Bash(ls *), Bash(git *), Bash(tail *)
3-
description: Check on a background feature agent running in a tmux session
2+
allowed-tools: Bash(tmux *), Bash(docker *), Bash(crosslink *), Bash(cat *), Bash(test *), Bash(ls *), Bash(git *), Bash(tail *), Bash(grep *)
3+
description: Check on background feature agents running in containers or tmux sessions
44
---
55

66
## Context
77

8-
- Active tmux sessions: !`tmux list-sessions 2>/dev/null || echo "no tmux server running"`
8+
- Running containers: !`docker ps --filter label=crosslink-agent=true --format 'table {{.Names}}\t{{.Status}}' 2>/dev/null`
9+
- Active tmux sessions: !`tmux list-sessions 2>/dev/null`
910
- Current worktrees: !`git worktree list`
1011

1112
## Your task
1213

13-
The user optionally provides a tmux session name (e.g. `feat-add-batch-retry`). If no session name is given, check **all** active `feat-*` tmux sessions and report a summary for each.
14+
The user optionally provides an agent name (e.g. `crosslink-task-add-batch-retry` or `feat-add-batch-retry`). If no name is given, check **all** active feature agents (both containers and tmux sessions) and report a summary for each.
1415

15-
### 1. Identify sessions to check
16+
### 1. Identify agents to check
1617

17-
- If the user provided a session name, use that single session.
18-
- If no session name was provided, list all tmux sessions whose names start with `feat-`: `tmux list-sessions -F '#{session_name}' 2>/dev/null | grep '^feat-'`
19-
- If no `feat-*` sessions exist, report "No active feature agent sessions found."
18+
#### a. Find container-based agents
2019

21-
### 2. For each session, perform these checks:
20+
1. Get this repo's worktree paths: `git worktree list --porcelain | grep '^worktree ' | sed 's/^worktree //'`
21+
2. List crosslink containers: `docker ps -a --filter label=crosslink-agent=true --format '{{.Names}} {{.Status}} {{.Label "crosslink-task"}}' 2>/dev/null`
22+
3. Match containers to this repo: for each container, check if its `crosslink-task` label value matches any of this repo's worktree directory names (the last path component)
23+
4. If the user provided a name starting with `crosslink-task-`, filter to that specific container
2224

23-
#### a. Check the sentinel file
25+
#### b. Find tmux-based agents
2426

25-
Find the worktree path for this session by checking `git worktree list` and matching the session name to a feature branch. The session name `feat-<slug>` corresponds to branch `feature/<slug>`.
27+
1. Get `feat-*` tmux sessions: `tmux list-sessions -F '#{session_name} #{session_path}' 2>/dev/null | grep '^feat-'`
28+
2. Only include sessions whose `session_path` matches one of this repo's worktree paths
29+
3. If the user provided a name starting with `feat-`, filter to that specific session
30+
31+
If no agents found in either mode, report "No active feature agents for this repo."
32+
33+
### 2. For each agent, perform these checks:
34+
35+
#### For container-based agents:
36+
37+
##### a. Check the sentinel file
38+
39+
Get the worktree path by matching the container's `crosslink-task` label to a worktree directory name from `git worktree list`.
40+
41+
- Check: `cat <worktree-path>/.kickoff-status 2>/dev/null`
42+
- If it contains `DONE`, mark as finished.
43+
- If it contains `CI_FAILED`, mark as CI failure.
44+
45+
##### b. Check container status
46+
47+
```bash
48+
docker inspect --format '{{.State.Status}} (exit {{.State.ExitCode}})' <container-name>
49+
```
50+
51+
Possible states: `running`, `exited` (check exit code), `restarting`, `paused`.
52+
53+
##### c. Capture recent output
54+
55+
```bash
56+
docker logs --tail 80 <container-name> 2>&1
57+
```
58+
59+
##### d. Analyze state
60+
61+
- **Working**: Container status is `running`, no sentinel file, recent tool calls visible in logs
62+
- **Idle**: Container is `running` but no recent output changes — may be thinking or waiting for API
63+
- **Error**: Container `exited` with non-zero exit code, or error messages in recent logs
64+
- **Done**: Sentinel file says `DONE`, or container exited with code 0
65+
- **CI Failed**: Sentinel file says `CI_FAILED`
66+
67+
#### For tmux-based agents:
68+
69+
##### a. Check the sentinel file
70+
71+
Get the worktree path for this session from tmux: `tmux display-message -t <session-name> -p '#{session_path}'`. Alternatively, match the session name to a feature branch in `git worktree list`.
2672

2773
- Check if `.kickoff-status` exists in the worktree: `cat <worktree-path>/.kickoff-status 2>/dev/null`
2874
- If it contains `DONE`, mark this session as finished.
2975

30-
#### b. Capture the terminal state
76+
##### b. Capture the terminal state
3177

3278
```bash
3379
tmux capture-pane -t <session-name> -p -S -80
3480
```
3581

3682
This captures the last ~80 lines of visible output.
3783

38-
#### c. Analyze state
84+
##### c. Analyze state
3985

4086
Read the captured output and determine the agent's current state:
4187

@@ -46,38 +92,49 @@ Read the captured output and determine the agent's current state:
4692

4793
### 3. Report
4894

49-
When checking **multiple sessions**, use a compact table format:
95+
When checking **multiple agents**, use a compact table format with a backend indicator:
5096

5197
```
5298
Feature Agents:
5399
54-
feat-add-retry Working Implementing retry logic in _sources.py
55-
feat-fix-lens-bug Done All changes committed and reviewed
56-
feat-new-cli-cmd Waiting Asking about CLI argument format
100+
crosslink-task-add-retry [container] Working Implementing retry logic in _sources.py
101+
crosslink-task-fix-lens [container] Done All changes committed and reviewed
102+
feat-new-cli-cmd [tmux] Waiting Asking about CLI argument format
57103
```
58104

59-
When checking a **single session**, use the detailed format:
105+
When checking a **single agent**, use the detailed format:
60106

61107
```
62-
Session: <name>
63-
Status: <Working | Waiting | Done | Error>
108+
Agent: <name>
109+
Backend: <container|tmux>
110+
Status: <Working | Idle | Waiting | Done | Error>
64111
65112
<2-3 sentence summary of what the agent is currently doing or has accomplished>
66113
```
67114

115+
For container agents, also show resource usage:
116+
```bash
117+
docker stats --no-stream --format ' CPU: {{.CPUPerc}} Memory: {{.MemUsage}}' <container-name> 2>/dev/null
118+
```
119+
68120
### 4. Offer actions
69121

70-
Based on the status of each session, suggest relevant next steps:
122+
#### For container agents:
123+
124+
- **If working/idle**: "Check back later, or view live logs: `crosslink container logs <name> -f`"
125+
- **If done**: "Agent finished. Review the changes: `cd <worktree-path> && git log --oneline <base-branch>..HEAD`"
126+
- **If error**: Show the relevant error output. Suggest: "Debug with: `crosslink container shell <name>` or view full logs: `crosslink container logs <name> --tail 500`"
127+
- **If exited (non-zero)**: "Container exited with error. View logs: `crosslink container logs <name>`. Restart with: `crosslink container kill <name> && crosslink container start <worktree-path>`"
128+
129+
#### For tmux agents:
71130

72131
- **If working**: "Check back later, or attach directly: `tmux attach -t <name>`"
73132
- **If waiting for input**: Read the question, and ask the user what to answer. If the user provides an answer, send it: `tmux send-keys -t <session-name> "<response>" Enter`
74-
- **If done**: "Agent finished. Review the changes: `cd <worktree-path> && git log --oneline develop..HEAD`"
133+
- **If done**: "Agent finished. Review the changes: `cd <worktree-path> && git log --oneline <base-branch>..HEAD`"
75134
- **If error**: Show the relevant error output and suggest the user attach to debug: `tmux attach -t <name>`
76135

77-
When multiple sessions are reported, only show detailed actions for sessions that need attention (Waiting or Error).
78-
79136
## Constraints
80137

81138
- Do not modify any files in the worktree — this is a read-only check.
82-
- Do not kill the tmux session unless the user explicitly asks.
83-
- When relaying a user's answer to a waiting prompt, send exactly what the user provides — do not embellish or modify.
139+
- Do not kill containers or tmux sessions unless the user explicitly asks.
140+
- When relaying a user's answer to a waiting tmux prompt, send exactly what the user provides — do not embellish or modify.

.claude/commands/commit.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
allowed-tools: Bash(git *), Bash(crosslink *)
3+
description: Commit changes and auto-document the result on the active crosslink issue
4+
---
5+
6+
## Context
7+
8+
- Working tree status: !`git status --short`
9+
- Current branch: !`git branch --show-current`
10+
- Active session: !`crosslink session status 2>/dev/null`
11+
12+
## Your task
13+
14+
The user wants to commit their current changes. You will create a well-formed git commit AND automatically record a result comment on the active crosslink issue.
15+
16+
### 1. Review changes
17+
18+
Run `git diff --cached --stat` and `git diff --stat` to see staged and unstaged changes. If nothing is staged, stage the relevant files (ask the user if unclear which files to include). Never use `git add -A` blindly — stage specific files.
19+
20+
### 2. Write the commit message
21+
22+
- Summarize what changed and why (1-2 sentences)
23+
- Follow conventional commit style if the project uses it
24+
- Include the crosslink issue reference if an active issue exists (e.g. `[CL-5]`)
25+
26+
### 3. Create the commit
27+
28+
```bash
29+
git commit -m "<message>"
30+
```
31+
32+
### 4. Auto-document the result on the active crosslink issue
33+
34+
After a successful commit, check if there's an active crosslink session with an active issue:
35+
36+
```bash
37+
crosslink session status
38+
```
39+
40+
If an active issue exists, record the commit as a result comment:
41+
42+
```bash
43+
crosslink issue comment <issue-id> "Committed: <first line of commit message> | Files: <shortstat summary>" --kind result
44+
```
45+
46+
For example:
47+
```bash
48+
crosslink issue comment 5 "Committed: Add typed comment support to schema | Files: 14 files changed, 312 insertions(+), 48 deletions(-)" --kind result
49+
```
50+
51+
If no active session or issue, skip the comment silently.
52+
53+
### 5. Show summary
54+
55+
Display:
56+
- The commit hash and message
57+
- Files changed summary
58+
- Whether the result was recorded on a crosslink issue
59+
60+
## Constraints
61+
62+
- Never force-push or amend commits without explicit user request.
63+
- Never use `git add -A` or `git add .` without confirming with the user.
64+
- Always record the result comment after a successful commit when an active issue exists.
65+
- If the commit fails (e.g. pre-commit hook), fix the issue and retry — do NOT record a result comment for failed commits.

0 commit comments

Comments
 (0)