Context Bridge
Use this skill when a task needs local repository context packaged for a web LLM, MCP client, browser companion, or another agent that can consume files and structured patches.
- Use
bundle,map,select, orplaybookto stage context. - Instruct the model to return only
--- sempatch ---YAML blocks. - Use
applyin dry-run mode first, then--writeonly after the diff is understood. - Prefer MCP when the client can call tools directly.
- Use the browser companion for web UI workflows that would otherwise rely on manual copy/paste.
Core Commands
context-bridge bundle <repo> --manifest-only -o manifest.md
context-bridge map <repo> --query "bug in login flow" -o repo-map.md
context-bridge playbook <repo> --task "bug in login flow" -o playbook.md
context-bridge select <repo> --task "bug in login flow" -o selected-context.md
context-bridge apply answer.md --root <repo>
context-bridge apply answer.md --root <repo> --write
context-bridge migrate-old-patches legacy-answer.md -o answer.sempatch.md
context-bridge mcp
Packing Strategy
Start narrow, then widen:
- Generate a manifest first when you do not know the repository shape.
- Generate a repo map when the task mentions symbols or ownership.
- Use
selectfor task-aware file choice within a token budget. - Use
bundlewhen you already know the exact files or globs needed. - Add visual snapshots with
--visualfor frontend components.
SemPatch
SemPatch blocks look like this:
--- sempatch ---
file: src/example.py
language: python
op: replace
selector:
rule:
pattern: |
def hello():
$$$BODY
replacement: |
def hello():
return "updated"
--- end sempatch ---
For new files, use:
--- sempatch ---
file: src/new_file.py
language: python
op: create_file
content: |
print("hello")
--- end sempatch ---
Selectors must match exactly one AST node. If a node is ambiguous, add selector.anchor.
MCP Surface
pack_contextrepo_mapcontext_playbookselect_context_for_taskscan_text_for_secretsinspect_sempatchesapply_patchessempatch_schema
Profiles
Store repeatable defaults in .context-bridge.toml.
[profiles.default]
include = ["src/**/*.py", "tests/**/*.py", "pyproject.toml"]
exclude = ["**/fixtures/**"]
extensions = ["py", "md", "toml"]
max_total_bytes = 1000000
respect_gitignore = true
[verify]
python = ["python", "-m", "ruff", "check", "--quiet"]
References
references/workflow.mdreferences/ecosystem.mdreferences/patch-format.mdreferences/competitive-landscape.md
Source: ershiyidian/context-bridge — distributed by TomeVault.