agentleFS
PiloTracerPiloTracer/pilo.ai.logicbison/skills/project-query-setup/skill.md

project-query-setup

Skill0 starsChanged 5 months agoMITView on GitHub

Optional integration: guide through tools-project API key creation, MCP server registration, and connectivity test. OS-aware (tailors guidance per framework).

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 6 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Key security: Never log the API key. Never store it in shell history.

    line 22
  2. Distinctive:

    Verify before claiming done: Run a live query to the API and show the actual response.

    line 23
  3. Very specific:

    Operator handoff: every response that ends a turn follows the Operator handoff contract — terse output.

    line 24
  4. Very specific:

    Read the current OS identity from START_HERE.md or .cursorrules:

    line 46
  5. Distinctive:

    If any prerequisite fails, stop and tell the user what to fix.

    line 69
  6. Distinctive:

    Wait for the user to confirm they have the key.

    line 83
  7. Distinctive:

    Run a live query and show the result:

    line 103
  8. Very specific:

    If 401 Unauthorized — the key is wrong or revoked.

    line 119
  9. Very specific:

    If 403 Forbidden — the user is not a superuser.

    line 120
  10. Very specific:

    If Connection refused — API is not running.

    line 121
  11. Very specific:

    If REGISTRY_EXISTS=yes, read .work/context/MCP_REGISTRY.md and check whether a registration matching this config file + server already …

    line 151
  12. Distinctive:

    Before applying Branch A, B, or C, present this prompt to the operator:

    line 155
  13. Very specific:

    Wait for the operator's explicit yes.

    line 167
  14. Very specific:

    After the MCP block is written and validated, append to .work/context/MCP_REGISTRY.md:

    line 171
  15. Distinctive:

    Run each check and report the result:

    line 276
  16. Very specific:

    Run ~/.tools-project-key check and a live query.

    line 316

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

project-query-setup

Purpose: Guide user through connecting their coding agent to tools-project, and teach it to query tasks, tickets, projects, and clients for context-aware work.

Deploy to: Any Agent OS framework (.ai, .ai.ui, .ai.biz, .ai.soc) — optional integration.

Tutorial companion: .work/docs/tutorials/LLM-2-API_SETUP.md (step-by-step setup walkthrough)


Hard rules

  1. Optional integration. This skill is never required. The user must explicitly ask to set it up or the director must ask first.
  2. Read-only. The API provides read-only access. No mutations, no writes, no data modification.
  3. Key security. Never log the API key. Never store it in shell history. /tmp is forbidden for key material. The ~/.tools-project-key file must be chmod 600.
  4. Verify before claiming done. Run a live query to the API and show the actual response. Never claim "connected" without evidence.
  5. Operator handoff: every response that ends a turn follows the Operator handoff contract — terse output; approvals under **Needs your approval:** citing path:L<n>; questions numbered under **Needs your answer:**; exactly one **Next step:** command; one line when nothing is needed (Form A). Decisions and questions never mixed; empty sections omitted.

Modes

InvocationMode
@project-query-setup installFull guided setup: generate key → create file → test → register MCP
@project-query-setup statusCheck if connected (key file exists? API reachable? MCP tools listed?)
@project-query-setup keyGuide the user through web UI → key creation → ~/.tools-project-key
@project-query-setup testVerify connectivity by listing projects
@project-query-setup register-mcpRegister MCP server in consuming project's coding-agent config
@project-query-setup helpShow available tools and usage patterns for this OS
@project-query-setup (no verb)Default to status mode

Install protocol

Step 1 — Detect OS context

Read the current OS identity from START_HERE.md or .cursorrules:

DetectedOSWhat it can do
.ai/ skillsEngineering OSQuery tasks/tickets for code work, build commit messages, verify HANDOFF vs live state, load project context before new features
.ai.ui/ skillsUI Design OSCheck which tickets need UI work, get client/project context for screen design, search for existing components
.ai.biz/ skillsBusiness OSList all projects/clients for portfolio review, identify clients needing attention, find content to share
.ai.soc/ skillsSecurity OSFind tickets flagged for security review, check task status for pen test findings, search for vulnerability patterns

Store this in an OS_CONTEXT variable for tailoring the rest of the protocol.

Step 2 — Prerequisites gate

Check and report:

  1. Is python3 available? (required for MCP server)
  2. Is there a running tools-project instance?
    • Local: try curl -s http://localhost:8300/healthz
    • Remote: ask user for URL
  3. Can the user reach the web UI?
    • Local: http://localhost:18513/settings/api-keys
    • Remote: https://<user-provided-url>/settings/api-keys

If any prerequisite fails, stop and tell the user what to fix.

Step 3 — Key creation (web UI)

Guide the user:

1. Open: <URL>/settings/api-keys
2. Click "+ New key"
3. Enter a label (e.g. "My laptop", "Agent OS integration")
4. Click "Create"
5. COPY the key now — it starts with "tools_project_"

Wait for the user to confirm they have the key. Do NOT ask them to paste it into chat.

Step 4 — Create the key file

Tell the user to create ~/.tools-project-key with their key:

# For local tools-project (no BASE_URL):
echo "tools_project_YOUR_KEY_HERE" > ~/.tools-project-key
chmod 600 ~/.tools-project-key

# For remote tools-project:
printf 'BASE_URL=https://project.cloudsys.win\ntools_project_YOUR_KEY_HERE\n' > ~/.tools-project-key
chmod 600 ~/.tools-project-key

Critical: Ask the user to replace YOUR_KEY_HERE with the actual key they copied. If the user is willing to paste the key into the conversation and asks you to write the file, run the command for them — but never log, display, or store the key value anywhere else. Always chmod 600.

Step 5 — Test connectivity

Run a live query and show the result:

curl -s http://localhost:8300/v1/agent/projects \
  -H "X-Api-Key: $(head -n2 ~/.tools-project-key | tail -n1)"

For remote:

BASE_URL=$(grep BASE_URL= ~/.tools-project-key | cut -d= -f2-)
KEY=$(tail -n1 ~/.tools-project-key)
curl -s "$BASE_URL/v1/agent/projects" -H "X-Api-Key: $KEY"

Expected: { "ok": true, "data": [...] } with project names. Show the actual output.

If 401 Unauthorized — the key is wrong or revoked. Go back to Step 3. If 403 Forbidden — the user is not a superuser. Tell them to contact their admin. If Connection refused — API is not running. Stop and tell user.

Step 6 — Deploy MCP server

Detect which coding agent config files exist in this project:

for cfg in opencode.json .cursor/mcp.json .claude/settings.json .claude/mcp.json codex.json; do
  test -f "$cfg" && echo "FOUND: $cfg"
done
test -f .cursor/mcp.json && echo "CURSOR_MCP=yes" || true
test -f .claude/settings.json && echo "CLAUDE_CONFIG=yes" || true
test -f .claude/mcp.json && echo "CLAUDE_MCP=yes" || true
test -f opencode.json && echo "OPENCODE=yes" || true

Copy the MCP server file (all branches):

mkdir -p .opencode/mcp/project-mcp
cp /mnt/work/Projects/tools-project/.opencode/mcp/project-mcp/mcp_server.py \
   .opencode/mcp/project-mcp/

Check for previously approved registrations:

test -f .work/context/MCP_REGISTRY.md && echo "REGISTRY_EXISTS=yes" || echo "REGISTRY_EXISTS=no"

If REGISTRY_EXISTS=yes, read .work/context/MCP_REGISTRY.md and check whether a registration matching this config file + server already exists. If it does and the MCP server path hasn't changed, skip the confirmation prompt — proceed directly to the matching branch.

Operator confirmation gate (mandatory before modifying any coding-agent config):

Before applying Branch A, B, or C, present this prompt to the operator:

MCP registration is about to modify your coding-agent config.

  • Config file to modify: <detected config file>
  • Server to register: tools-project
  • Command: python3 .opencode/mcp/project-mcp/mcp_server.py

Proceed with registration? (yes/no)

Present this gate as a Form B Operator handoff close: the approval enumerated under **Needs your approval:** citing path:L<n> of the config file to modify, ending with one **Next step:** command — per SKILL_DEPENDENCIES.md.

Wait for the operator's explicit yes. Do not proceed on silence, "maybe", or any non-affirmative response. If the operator says no, stop Step 6 and skip to the completion checklist (items 5 and 6 will be skip).

Record the approval (after successful registration):

After the MCP block is written and validated, append to .work/context/MCP_REGISTRY.md:

mkdir -p .work/context
if ! test -f .work/context/MCP_REGISTRY.md; then
  echo "# MCP Registry — approved registrations" > .work/context/MCP_REGISTRY.md
  echo "" >> .work/context/MCP_REGISTRY.md
  echo "| Config file | Server | Approved | MCP server path |" >> .work/context/MCP_REGISTRY.md
  echo "|-------------|--------|----------|-----------------|" >> .work/context/MCP_REGISTRY.md
fi
echo "| <config-file> | tools-project | $(date +%Y-%m-%d) | .opencode/mcp/project-mcp/mcp_server.py |" >> .work/context/MCP_REGISTRY.md

This record prevents re-prompting on subsequent install or register-mcp runs — the skill reads the registry and skips confirmation for already-approved entries.

Branch A — opencode.json exists: Register in opencode format (after confirmation):

python3 << 'PYEOF'
import json
with open('opencode.json') as f:
    cfg = json.load(f)
cfg.setdefault('mcp', {})['tools-project'] = {
    "type": "local",
    "command": ["python3", ".opencode/mcp/project-mcp/mcp_server.py"],
    "enabled": True
}
with open('opencode.json', 'w') as f:
    json.dump(cfg, f, indent=2)
    f.write('\n')
PYEOF
python3 -c "import json; json.load(open('opencode.json')); print('opencode.json: valid')"

Branch B — .cursor/mcp.json exists (Cursor agent): Register in Cursor MCP format:

python3 << 'PYEOF'
import json, os
path = '.cursor/mcp.json'
cfg = json.load(open(path)) if os.path.exists(path) else {}
cfg.setdefault('mcpServers', {})['tools-project'] = {
    "command": "python3",
    "args": [".opencode/mcp/project-mcp/mcp_server.py"],
    "transport": "stdio"
}
os.makedirs('.cursor', exist_ok=True)
with open(path, 'w') as f:
    json.dump(cfg, f, indent=2)
    f.write('\n')
PYEOF
python3 -c "import json; json.load(open('.cursor/mcp.json')); print('.cursor/mcp.json: valid')"

Branch C — .claude/settings.json or .claude/mcp.json exists (Claude Code): Register in Claude Code MCP format:

python3 << 'PYEOF'
import json, os
path = '.claude/mcp.json' if os.path.exists('.claude/mcp.json') else '.claude/settings.json'
os.makedirs('.claude', exist_ok=True)
cfg = json.load(open(path)) if os.path.exists(path) else {}
cfg.setdefault('mcpServers', {})['tools-project'] = {
    "command": "python3",
    "args": [".opencode/mcp/project-mcp/mcp_server.py"],
    "type": "stdio"
}
with open(path, 'w') as f:
    json.dump(cfg, f, indent=2)
    f.write('\n')
PYEOF
python3 -c "import json; json.load(open('${path}')); print('${path}: valid')"

Branch D — No known agent config detected (no confirmation needed — no files modified): Output the MCP registration details so the operator's own coding agent can register itself:

ⓘ MCP server ready — registration needed for your coding agent.

The MCP server file has been copied to .opencode/mcp/project-mcp/mcp_server.py.
However, no known coding-agent config file was detected in this project.

Provide the following details to your coding agent and ask it to register the MCP server in its config:

Server name:   tools-project
Type:          local (stdio transport)
Command:       python3 .opencode/mcp/project-mcp/mcp_server.py
Key file:      ~/.tools-project-key (chmod 600)

Your agent knows its own config format — it will register the server correctly.
Common agent config locations:

  • opencode: opencode.json → "mcp" block
  • Cursor: .cursor/mcp.json → "mcpServers" block
  • Claude Code: .claude/mcp.json or .claude/settings.json → "mcpServers" block
  • Other: check your tool's MCP integration docs

End the Branch D output with the Operator handoff close (Form B — the registration hand-off to the operator's agent enumerated under **Needs your approval:** — + one **Next step:** command) per SKILL_DEPENDENCIES.md.

Step 7 — Verify with completion checklist

Run each check and report the result:

#CheckHowResult
1Key file existstest -f ~/.tools-project-keypass / fail
2Permissions 600stat -c '%a' ~/.tools-project-key shows 600pass / fail
3API reachablecurl -s <url>/healthz returns 200pass / fail
4Auth workscurl -s <url>/v1/agent/projects -H "X-Api-Key: $(tail -n1 ~/.tools-project-key)" returns projectspass / fail
5MCP server file presenttest -f .opencode/mcp/project-mcp/mcp_server.py (or consuming project)pass / skip
6MCP registered in coding agent configCheck the detected agent config for tools-project entry (opencode: mcp.tools-project, Cursor/Claude: mcpServers.tools-project)pass / skip
7python3 availablewhich python3pass / fail

End the checklist report with the Operator handoff close (Form A Next: … when all pass, or Form B **Needs your approval:** / **Needs your answer:** / **Next step:** when any check needs operator action) per SKILL_DEPENDENCIES.md.

Step 8 — Show OS-specific usage patterns

Connected to tools-project. Found N projects.

Your {OS_NAME} agents can now:

  {OS-specific capabilities from the table in Step 1}

To use this from any skill, add this prerequisite line
to the skill's preamble:

  Prerequisites: tools-project MCP server registered
  (provides list_projects, get_project_context,
  get_task_info, get_ticket_info, search_entities tools)

Reference: .work/docs/agent-query-api.md
Tutorial:  .work/docs/tutorials/LLM-2-API_SETUP.md

End the install summary with the Operator handoff close (Form A Next: … or Form B **Needs your approval:** / **Needs your answer:** / **Next step:**) per SKILL_DEPENDENCIES.md.


Status protocol

Run ~/.tools-project-key check and a live query. Report:

Key file:    {present/missing} ({path})
Permissions: {chmod} (should be 600)
API:         {reachable/unreachable} {url}
Auth:        {ok / 401 / 403}
Projects:    {count} accessible
MCP tools:   {count} registered ({names})

End the status report with the Operator handoff close (Form A Next: … when all green, or Form B **Needs your approval:** / **Needs your answer:** / **Next step:** when the operator must fix something) per SKILL_DEPENDENCIES.md.


Key protocol (standalone)

Same as Steps 3-4 from Install protocol. Lighter — no MCP registration, no API test (user runs test or status after).

End the key report with the Operator handoff close (Form A Next: … or Form B **Needs your approval:** / **Needs your answer:** / **Next step:**) per SKILL_DEPENDENCIES.md.


Test protocol

Same as Step 5 from Install protocol. Returns a yes/no + response snippet.

End the test report with the Operator handoff close (Form A Next: … or Form B **Needs your approval:** / **Needs your answer:** / **Next step:**) per SKILL_DEPENDENCIES.md.


Help protocol

Show the 5 MCP tools available and their descriptions. Then show one domain-specific example for the current OS:

OSExample
Engineering"What's the status of ticket TPR-T-12?" → get_ticket_info(ref="TPR-T-12")
UI Design"What projects need UI work?" → list_projects + get_task_info(status="todo")
Business"Which clients need attention?" → list_projects + get_project_context() per project
Security"Find tickets related to rate limiting" → search_entities(q="rate limit")

End the help output with the Operator handoff close (Form A Next: … or Form B **Needs your approval:** / **Needs your answer:** / **Next step:**) per SKILL_DEPENDENCIES.md.


Reference

DocPath
Full API + MCP guide.work/docs/agent-query-api.md
Step-by-step tutorial.work/docs/tutorials/LLM-2-API_SETUP.md
Feature SPEC.work/features/agent-query-api/20260701-SPEC.md
MCP server source.opencode/mcp/project-mcp/mcp_server.py

Anti-patterns to refuse

  • Claiming "connected" without a live API response
  • Writing the key file without chmod 600 after
  • Asking the user to paste their API key into chat
  • Storing the key in /tmp or any non-~/.tools-project-key location
  • Logging the key value in any output
  • Registering MCP in the framework's own config (it belongs in the consuming project's coding-agent config)
  • Burying operator actions/questions in prose instead of the closing Operator handoff block

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.