mache-usage
Skill2 starsChanged 6 months agoApache-2.0View on GitHub
Start or locate a running mache MCP server for a source path or .db file. Builds a .db from source if needed. Base skill used by diagram-gen-spec, diagram-gen-emergent, and review-prep. Returns port and session ID.
- Sends data out
In this repository43 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- break-glassSkill
- claim-ledgerSkill
- contract-parity-auditSkill
- counterfactual-auditSkill
- design-doc-reviewSkill
- diagram-gen-emergentSkill
- diagram-gen-specSkill
- doc-triageSkill
- explain-workSkill
- feature-implSkill
- finding-triageSkill
- first-party-auditSkill
- gh-token-rotateSkill
- handoffSkill
- implementSkill
- jj-stackSkill
- linear-escalation-triageSkill
- park-workSkill
- pr-boardSkill
- pr-bucketsSkill
- prior-art-cartographerSkill
- problem-decomposerSkill
- pr-review-kitSkill
- pr-reviewSkill
- pr-suggestionSkill
- readme-restructureSkill
- repo-description-polishSkill
- repo-homepage-setSkill
- repo-social-previewSkill
- repo-topic-taggerSkill
- review-prepSkill
- review-queueSkill
- reviewSkill
- self-auditSkill
- structural-pr-reviewSkill
- surveySkill
- taskfile-ci-paritySkill
- test-fidelitySkill
- workflow-auditSkill
- work-scopeSkill
- writing-pr-descriptionsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Ensure a mache MCP server is running for a given source and return the session info.
- Very specific: line 41
If RUNNING: skip to Step 4.
- Distinctive: line 92
If the server fails to start after 10 seconds:
- Distinctive: line 98
Do NOT throw an error that blocks the caller.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
mache-usage — MCP Server Lifecycle
Ensure a mache MCP server is running for a given source and return the session info.
Arguments
$ARGUMENTS — <source-path-or-db> [port]
source: path to a directory of source files or a pre-built.dbfileport: optional, default7532
What To Do
Step 1: Parse arguments
SOURCE="<first argument>"
PORT="${2:-7532}"Step 2: Check for existing server
curl -s --max-time 5 -X POST http://localhost:$PORT/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"check","version":"1"}}}' \
| python3 -c "import sys,json; d=json.load(sys.stdin); print('RUNNING' if 'result' in d and 'error' not in d else 'NOT_RUNNING')" 2>/dev/null || echo "NOT_RUNNING"If RUNNING: skip to Step 4.
Step 3: Start the server
MACHE_BIN=$(which mache 2>/dev/null || echo "$HOME/go/bin/mache")
if [ ! -x "$MACHE_BIN" ]; then
echo "status: unavailable — mache binary not found in PATH or ~/go/bin/"
exit 0
fimache auto-detects schema from the source (Go files → go-schema.json, .db → serve directly). Do NOT pass --schema unless the user explicitly requests a specific schema.
$MACHE_BIN serve "$SOURCE" --http "localhost:$PORT" &
MACHE_PID=$!
for i in $(seq 1 10); do
sleep 1
curl -s --max-time 2 -X POST http://localhost:$PORT/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"check","version":"1"}}}' \
| python3 -c "import sys,json; d=json.load(sys.stdin); exit(0) if 'result' in d else exit(1)" 2>/dev/null && echo "Server ready" && break
if [ $i -eq 10 ]; then
kill $MACHE_PID 2>/dev/null
echo "status: unavailable — mache serve failed to start after 10 seconds"
exit 0
fi
doneStep 4: Initialize session and return info
SESSION=$(curl -s -X POST http://localhost:$PORT/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"mache-usage","version":"1"}}}' \
-D - 2>/dev/null | grep -i "^mcp-session-id:" | tr -d '\r' | awk -F': ' '{print $2}' | tr -d ' ')
if [ -z "$SESSION" ]; then
echo "status: unavailable — session initialization failed"
exit 0
fi
echo "status: available"
echo "port: $PORT"
echo "session: $SESSION"Step 5: Graceful degradation
If the server fails to start after 10 seconds:
pkill -f "mache serve.*$PORT" 2>/dev/nullReport: status: unavailable — mache serve failed to start
Do NOT throw an error that blocks the caller. Return the status string and let the caller decide.
Helper: Call an MCP tool
Once you have port + session, call any mache tool:
mcp_call() {
local PORT=$1 SESSION=$2 TOOL=$3 ARGS=$4
curl -s -X POST http://localhost:$PORT/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "mcp-session-id: $SESSION" \
-d "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/call\",\"params\":{\"name\":\"$TOOL\",\"arguments\":$ARGS}}" \
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d['result']['content'][0]['text'])" 2>/dev/null
}Usage: mcp_call $PORT $SESSION get_overview '{}'
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

