metagit-context-pack
Skill4 starsChanged 12 days agoMITView on GitHub
Token-efficient workspace onboarding via tiered context packs — map, repo cards, session digest, objectives, approvals, repomix profiles. Use at session start or when scoping work in a metagit-managed workspace.
In this repository62 other files it gives its agents.
- agentsAGENTS.md
- docs/agents.mdAGENTS.md
- agentsAGENTS.md
- agentsCopilot instructions
- .cursor/rules/github-cli.mdcCursor rule
- .cursor/rules/project-level.mdcCursor rule
- llms.txtllms.txt
- gitnexus-cliSkill
- gitnexus-debuggingSkill
- gitnexus-exploringSkill
- gitnexus-guideSkill
- gitnexus-impact-analysisSkill
- gitnexus-refactoringSkill
- humanizerSkill
- metagit-agent-accessSkill
- metagit-agent-coordinationSkill
- metagit-aosSkill
- metagit-bootstrapSkill
- metagit-campaignSkill
- metagit-cliSkill
- metagit-config-refreshSkill
- metagit-context-packSkill
- metagit-control-centerSkill
- metagit-gatingSkill
- metagit-gitnexusSkill
- metagit-graph-maintainSkill
- metagit-mcp-resourcesSkill
- metagit-multi-repoSkill
- metagit-projectsSkill
- metagit-release-auditSkill
- metagit-repo-impactSkill
- metagit-rewrite-campaignSkill
- metagit-sharing-stateSkill
- metagit-stampSkill
- metagit-upstream-scanSkill
- metagit-upstream-triageSkill
- metagit-workspace-scopeSkill
- metagit-workspace-syncSkill
- metagit-agent-accessSkill
- metagit-agent-coordinationSkill
- metagit-aosSkill
- metagit-bootstrapSkill
- metagit-campaignSkill
- metagit-cliSkill
- metagit-cliSkill
- metagit-config-refreshSkill
- metagit-control-centerSkill
- metagit-gatingSkill
- metagit-gitnexusSkill
- metagit-graph-maintainSkill
- metagit-mcp-resourcesSkill
- metagit-multi-repoSkill
- metagit-projectsSkill
- metagit-release-auditSkill
- metagit-repo-impactSkill
- metagit-rewrite-campaignSkill
- metagit-sharing-stateSkill
- metagit-stampSkill
- metagit-upstream-scanSkill
- metagit-upstream-triageSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 7 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Use this skill for the most token-efficient way to onboard into a metagit workspace.
- Very specific: line 11
Prefer metagit context pack --tier N --json over reading raw trees or full manifests.
- Very specific: line 23
Run from the umbrella repo that contains .metagit.yml (or pass -c path/to/.metagit.yml).
- Distinctive: line 28
Before editing — need project/repo boundaries and health without cloning everything
- Distinctive: line 33
Do not skip context packs and grep the filesystem when a manifest exists.
- Distinctive: line 61
Start tier 0 when you only need catalog boundaries (search-before-create, layout planning).
- Very specific: line 63
Use tier 2 at session open/return — digest includes first_session, manifest_changed, per-repo commit counts, active objective id.
- Distinctive: line 77
Prefer one command instead of manually chaining pack + session-start + objective:
- Distinctive: line 90
When you already know the target repo:
- Very specific: line 107
Use profiles instead of raw repomix on an entire tree.
- Very specific: line 202
Verify MCP host config: resources/read → metagit://gate/status → state_backend.backend should be http.
- Distinctive: line 209
When multiple agents share a workspace root via Syncthing:
- Very specific: line 252
Use CLI when operating shell-only (METAGIT_AGENT_MODE=true).
- Very specific: line 264
Use tool metagit_session_begin once when a full bootstrap envelope must update the session boundary.
- Distinctive: line 268
After packing, report to the user or parent agent:
≈ “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
Metagit context packs
Use this skill for the most token-efficient way to onboard into a metagit workspace.
Prefer metagit context pack --tier N --json over reading raw trees or full manifests.
<!-- modality:context_reduction -->Umbrella .metagit.yml stays on disk. Do not inject it: no config show --json without --confirm-full, no workspace list --include-workspace, no metagit://workspace/config?view=full without confirm=1. Maps default to 80 repos; check truncated. 500+ repos: metagit prompt workspace -k large-workspace --text-only and context-reduction.md.
Set non-interactive defaults:
export METAGIT_AGENT_MODE=trueRun from the umbrella repo that contains .metagit.yml (or pass -c path/to/.metagit.yml).
When to use
- Session start in any metagit-managed workspace
- Before editing — need project/repo boundaries and health without cloning everything
- Returning after idle — tier 2 digest shows what changed since last session
- Scoping a bugfix — tier 1 cards +
repomixprofile instead of whole-repo dumps - Coordinating humans and agents — objectives and approval queue state
Do not skip context packs and grep the filesystem when a manifest exists.
Tier workflow
| Tier | Command | Typical tokens | Contents |
| 0 | metagit context pack --tier 0 --json | ~100–400 | Workspace map: projects, repos, paths, clone status |
| 1 | metagit context pack --tier 1 --json | +200–600/repo | Tier 0 + repo cards (git state, stack hints, health flags) |
| 2 | metagit context pack --tier 2 --json | +digest | Tier 1 + session digest; updates session boundary |
Escalate tiers only when needed. Narrow tier 1/2 with --project and/or --repo.
Primary session command
metagit context pack --tier 0 --json --project P -c .metagit.yml # large umbrellas
metagit context pack --tier 2 --json --project P --repo R -c .metagit.ymlPair with operational prompts (paste --text-only output into agent context):
metagit prompt workspace -k session-start --text-only -c .metagit.yml
metagit prompt workspace -k context-pack --text-only -c .metagit.yml # tier escalation guideEscalation rules
- Start tier 0 when you only need catalog boundaries (search-before-create, layout planning).
- Move to tier 1 when git health, stack hints, or per-repo instructions matter.
- Use tier 2 at session open/return — digest includes
first_session,manifest_changed, per-repo commit counts, active objective id. - Tier 2 touches the session boundary — avoid running it from multiple agents simultaneously on a shared manifest (see multi-instance below).
Scoped packs
metagit context pack --tier 1 --json --project portfolio --repo api-gateway
metagit context pack --tier 2 --json --project portfolioMid-session context switch
<!-- modality:context_switch -->Prefer one command instead of manually chaining pack + session-start + objective:
eval "$(metagit context switch portfolio api-gateway)"
metagit context switch portfolio --json
metagit prompt workspace -k context-switch --text-onlyMCP: metagit_context_switch. Lean switch without pack/objective: metagit_project_context_switch.
See Context switch.
Single repo card
When you already know the target repo:
metagit context repo-card --project P --repo R --json -c .metagit.ymlCard fields include: status, health_flags (missing_clone, dirty, behind_remote, stale_head_30d), stack_hints, resolved agent_instructions excerpts.
Repomix profiles (scoped snapshots)
Bundled profiles: bugfix-local, config-edit, cross-repo-impact.
metagit context repomix --profile bugfix-local --project P --repo R -c .metagit.yml
metagit context repomix --profile config-edit --project P --repo R --output /tmp/pack.txtUse profiles instead of raw repomix on an entire tree. Pick profile by task:
| Profile | Use when |
bugfix-local | Implement or debug in src/, tests/ |
config-edit | Manifest or app config changes |
cross-repo-impact | Graph, schema, reference docs for dependency analysis |
Objectives (shared human ↔ agent state)
Persisted under .metagit/sessions/objectives.json.
metagit context objective list --json -c .metagit.yml
metagit context objective get --id obj-123 --json
echo '{"id":"obj-123","status":"in_progress","title":"Fix API timeout","repos":["portfolio/api"]}' \
| metagit context objective set -c .metagit.yml
metagit context objective complete --id obj-123 -c .metagit.yml
metagit context objective cancel --id obj-123 -c .metagit.ymlTier-2 digest surfaces active_objective_id when one objective is in progress.
Approvals (human-in-the-loop)
Queue under .metagit/approvals/pending.json.
metagit context approval request --action repo_sync --requested-by hermes --payload '{"project":"P","repo":"R"}' -c .metagit.yml
metagit context approval list --json -c .metagit.yml
metagit context approval list --status all --json
metagit context approval approve --id apr-001 --note "ok for staging" -c .metagit.yml
metagit context approval deny --id apr-002 --note "needs review" -c .metagit.ymlAgents: list pending approvals before mutating ops; never self-approve without operator policy.
Hermes session bootstrap
Wire metagit into Hermes (or any orchestrator) so every objective begins with bounded context.
When to call
| Trigger | Recommended tier |
| Session / objective open | 2 (full) or 0 (token-tight) |
| Project switch mid-session | 1 scoped to --project |
| Subagent handoff to one repo | 1 or repo-card + repomix |
| Idle return (>1 digest window) | 2 |
Commands
export METAGIT_AGENT_MODE=true
PACK_JSON="$(metagit context pack --tier 0 --json -c .metagit.yml)"
PROMPT_TEXT="$(metagit prompt workspace -k session-start --text-only -c .metagit.yml)"How to inject output
| Host pattern | Injection |
| Hermes system / bootstrap template | Include session-start prompt text; store or summarize pack JSON |
| Pre-turn shell hook | Run commands above; append stdout to conversation context or state file |
| Subagent task prompt | Pass tier-1 JSON for target --project/--repo plus subagent-handoff prompt |
| MCP-connected Hermes | Prefer MCP resources (metagit://catalog → map → prompts) or metagit_context_pack tier 2 once per session; see metagit-mcp-resources |
Token-tight bootstrap:
metagit context pack --tier 0 --json
metagit prompt workspace -k session-start --text-onlyDefault bootstrap (scope --project/--repo when known; unscoped tier 2 on 500+ repos is too large):
metagit context pack --tier 0 --json
metagit prompt workspace -k context-pack --text-only
metagit prompt workspace -k session-start --text-onlyFlags: --max-cards, --max-map-repos, --max-tokens (drops cards → digest → map rows).
Parse pack JSON top-level keys: workspace_name, tier, map, cards, digest.
Multi-agent coordination (remote state vs Syncthing)
Preferred: separate machines share coordination JSON through a coordinator running
metagit web serve and clients with METAGIT_STATE_URL / state.url. See skill
metagit-sharing-state and docs/reference/sharing-state.md.
Verify MCP host config: resources/read → metagit://gate/status → state_backend.backend should be http.
Alternative: Syncthing (or similar) on the same manifest root — use only when remote state is unavailable.
Syncthing conflict zones
When multiple agents share a workspace root via Syncthing:
Conflict zones
| Path | Risk | Mitigation |
.metagit.yml | Simultaneous catalog edits | Single writer; validate before save |
.metagit/sessions/* | Digest boundary race | One coordinator runs tier 2 per session window |
.metagit/sessions/objectives.json | Concurrent upserts | Idempotent objective id; list before set |
.metagit/approvals/pending.json | Duplicate rows | List before creating; unique action ids |
Agent rules
- Read after sync settles — wait for Syncthing idle, then
metagit config validateand tier 0/1 pack. - One manifest writer — designate the Hermes controller for catalog mutations (
metagit workspace …,metagit config patch --save). - Tier 2 once per session window — only the session-owning agent runs
--tier 2; others use tier 0/1. - Git state is local — Syncthing syncs manifest/state files, not clone contents; run
metagit project syncper machine. - Optional coordination file — teams may touch
.metagit/.manifest-lock(pid + timestamp) as a human-visible lock; metagit does not enforce it.
Stale sync detection
metagit context pack --tier 2 --json # check digest.manifest_changed
metagit config validate -c .metagit.ymlMCP equivalents (when MCP gate is ACTIVE)
| CLI | MCP tool |
context pack --tier N | metagit_context_pack (required tier) |
skills surface | metagit_skills_surface <!-- modality:skills_surface --> |
context compile | metagit_context_compile <!-- modality:context_compile --> |
context switch | metagit_context_switch <!-- modality:context_switch --> |
context repo-card | metagit_repo_card |
context objective list/set/complete/cancel | metagit_objective_list / metagit_objective_upsert / metagit_objective_edit |
context approval request/list/approve/deny | metagit_approval_request / metagit_approval_list / metagit_approval_resolve |
context handoff list/create/claim/complete | metagit_handoff_list / metagit_handoff_create / metagit_handoff_claim / metagit_handoff_complete |
context handoff heartbeat / claim --ttl | (CLI-only v0.13) — renew lease; expired claims auto-release <!-- modality:handoff_lease_heartbeat --> |
context events [--campaign] [--objective] | metagit_events (+ resource metagit://events/recent?since=) <!-- modality:coordination_events_scope --> |
Remote state: set METAGIT_STATE_* on the MCP server process; tools unchanged. Skill: metagit-sharing-state.
Use CLI when operating shell-only (METAGIT_AGENT_MODE=true); use MCP resources/tools when the IDE host exposes metagit (see metagit-mcp-resources for the read ladder).
MCP resource ladder (read-only)
| Step | URI |
| 1 | metagit://catalog |
| 2 | metagit://workspace/map?limit=80 |
| 3 | metagit://prompt/workspace/session-start?instructions=0 |
| 4 | metagit://session/meta |
| Scoped | metagit://project/{P}/summary, metagit://repo/{P}/{R}/card |
Use tool metagit_session_begin once when a full bootstrap envelope must update the session boundary.
Output contract
After packing, report to the user or parent agent:
- workspace name and tier used
- project/repo count from
map - repos with health flags (from
cardsif tier ≥ 1) - digest highlights if tier 2 (
first_session,manifest_changed, active objective) - recommended next step (search, sync, repomix profile, or prompt kind)
Related skills
metagit-sharing-state— multi-agent remote coordination (METAGIT_STATE_URL)metagit-cli— full CLI prompt and catalog referencemetagit-workspace-scope— gate and scope discoverymetagit-control-center— ongoing multi-repo coordinationmetagit-workspace-sync— guarded fetch/pull after pack shows stale repos
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.

