.factory/skills/backend-worker/SKILL.md
--- name: backend-worker description: Handles Python-side work: sidecar IPC, benchmark scripts, corpus generators, MCP server extensions, GPU benchmarks, documentation, and compatibility tests. --- # backend-worker NOTE: Startup and cleanup are handled by `worker-base`. This skill defines the WORK PROCEDURE. ## When to Use This Skill Use this worker for: - Edit planning intelligence (`src/tensor_grep/cli/repo_map.py`) — span extraction, plan seed, context ranking, rendering - Session system
npx skillsauth add oimiragieo/tensor-grep .factory/skills/backend-workerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
NOTE: Startup and cleanup are handled by worker-base. This skill defines the WORK PROCEDURE.
Use this worker for:
src/tensor_grep/cli/repo_map.py) — span extraction, plan seed, context ranking, renderingsrc/tensor_grep/cli/session_store.py) — caching, refresh, serve loopsrc/tensor_grep/cli/audit_manifest.py, checkpoint_store.py) — history, diff, policies, bundlessrc/tensor_grep/cli/rule_packs.py) — new packs, suppressionssrc/tensor_grep/cli/main.py) — new commands, flag wiringsrc/tensor_grep/cli/mcp_server.py) — new tools, paritybenchmarks/)benchmarks/gen_corpus.py)$env:PYTHONPATH = '...\src' syntax.uv pip install -e ".[dev,ast,nlp]" instead.C:\Users\oimir\.cargo\bin\cargo.exe (may not be on PATH).benchmarks/tg_rust.exe or build with cargo build --release -> rust_core/target/release/tg.exe.benchmarks/rg.zip auto-extract.cargo install ast-grep if not on PATH.Read feature description and preconditions carefully. Understand what assertions this feature fulfills.
Test-Driven Development FIRST: Write a failing Python test (in tests/) that exposes the specific behavior or proves the new contract. Run it and verify it fails. Only then implement.
Implement the Python logic. Follow:
{command, args, payload} -> {status, result, error}.mcp_server.py.run_ast_benchmarks.py). Always include suite, generated_at_epoch_s, and environment in JSON output.For benchmark scripts: Ensure the script:
--output <path> for JSON artifact outputsuite, generated_at_epoch_s, and environment fieldssg not installed)For MCP server changes: Ensure:
routing_backend and routing_reasontests/unit/test_mcp_server.pyFor repo_map.py changes (edit planning, rendering, context):
build_context_render_from_map (~line 1700), build_symbol_blast_radius_render (~line 2400), _render_context_parts (~line 1550), _render_source_block (~line 1400), _validation_commands_for_tests (~line 1660)_python_symbol_definitions (~line 600), _js_symbol_definitions (~line 700), _ts_symbol_definitions (~line 730), _rust_symbol_definitions (~line 760)For session_store.py changes:
_stale_reason (staleness detection), refresh_session, serve_session_stream<root>/.tensor-grep/sessions/<session_id>.jsoncommand field, response is one JSON lineFor audit/trust/ruleset changes:
audit_manifest.py (HMAC signing, chain verification)_RULE_PACKS dictRun local Python gates:
uv run ruff check .
uv run mypy src/tensor_grep
$env:PYTHONPATH = 'src'; uv run pytest -q
If touching benchmark scripts, run the script and validate its output:
python benchmarks/<script>.py --output artifacts/<output>.json
python -c "import json; json.load(open('artifacts/<output>.json'))"
{
"salientSummary": "Created benchmarks/run_ast_multilang_benchmarks.py measuring tg vs sg across Python/JS/TS/Rust corpora. Extended gen_corpus.py with --lang javascript/typescript/rust generators. JSON artifact shows Python ratio 1.42x, JS 1.38x, TS 1.45x, Rust 1.51x — all within 3.0 threshold. uv run pytest -q: 515 passed. ruff/mypy clean.",
"whatWasImplemented": "Added JavaScript, TypeScript, and Rust corpus generators to gen_corpus.py using realistic function/class patterns per language. Created run_ast_multilang_benchmarks.py following existing run_ast_benchmarks.py patterns. Script generates per-language corpora, runs hyperfine, produces JSON with per-language timing rows.",
"whatWasLeftUndone": "",
"verification": {
"commandsRun": [
{ "command": "python benchmarks/gen_corpus.py --kind ast-bench --lang javascript --out /tmp/js_corpus --files 100", "exitCode": 0, "observation": "100 .js files generated" },
{ "command": "python benchmarks/run_ast_multilang_benchmarks.py --output artifacts/bench_ast_multilang.json", "exitCode": 0, "observation": "4 language rows, all ratios < 3.0" },
{ "command": "uv run pytest -q", "exitCode": 0, "observation": "515 passed, 14 skipped" },
{ "command": "uv run ruff check .", "exitCode": 0, "observation": "clean" }
],
"interactiveChecks": [
{ "action": "Ran tg run --lang javascript 'function $F($$$ARGS) { return $EXPR; }' /tmp/js_corpus", "observed": "Found 100 matches across 100 files" }
]
},
"tests": {
"added": [
{ "file": "tests/unit/test_gen_corpus.py", "cases": [
{ "name": "test_js_corpus_generates_valid_files", "verifies": "JS files parse without error" },
{ "name": "test_ts_corpus_generates_valid_files", "verifies": "TS files parse without error" },
{ "name": "test_rust_corpus_generates_valid_files", "verifies": "Rust files parse without error" },
{ "name": "test_python_backward_compat", "verifies": "Default Python generation unchanged" }
]}
]
},
"discoveredIssues": []
}
development
--- name: rust-worker description: Handles all Rust-side work: control plane, native search engine (grep crates), native GPU engine (cudarc/CUDA), routing, index subsystem, rewrite substrate, and benchmark gates. --- # rust-worker NOTE: Startup and cleanup are handled by `worker-base`. This skill defines the WORK PROCEDURE. ## When to Use This Skill Use this worker for: - Rust control plane changes (`rust_core/src/main.rs`, routing, JSON output) - Native search engine embedding (grep-searche
development
Use tensor-grep for repository code search, symbol lookup, blast-radius analysis, and edit planning when solving codebase tasks or preparing patches.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------