
Inject
Surface budgeted, scoped prior learnings and patterns at task time via the ao inject CLI contract.
Overview
inject is an agent skill most often used in Build (also Operate) that defines the ao inject CLI output contract for scoped, budgeted knowledge injection into agent context.
Install
npx skills add https://github.com/boshu2/agentops --skill injectWhat is this skill?
- Stable markdown header "Injected Knowledge" with Last injection timestamp even on empty corpus
- JSON output contract for programmatic context assembly
- Skill-scoped filtering via --for including unknown-skill error path
- Quality-gate filter on candidate learnings before injection
- Integration scenarios linked to cli/cmd/ao inject_integration_test.go
- Empty corpus still emits "Injected Knowledge" header and "Last injection:" timestamp
- Behavior covered by inject_integration_test.go scenarios
Adoption & trust: 761 installs on skills.sh; 384 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your agent starts cold each task even though you already captured learnings and patterns under .agents.
Who is it for?
Builders standardizing on agentops who want test-backed inject behavior and --for skill scoping.
Skip if: Projects without a local .agents learnings corpus or those not using the ao CLI.
When should I use this skill?
Assembling task context and you need ao inject markdown/JSON behavior, --for scoping, or empty-corpus guarantees.
What do I get? / Deliverables
ao inject returns predictable Injected Knowledge markdown or JSON so the agent assembles prior corpus at the point of work.
- Injected Knowledge markdown block
- Optional JSON inject payload
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
JIT knowledge injection is primarily a Build concern when agents assemble context before coding. The skill specs ao inject behavior, JSON/markdown contracts, and --for filtering—core agent-tooling for agentops users.
Where it fits
Run ao inject before a feature task so patterns from prior sessions appear under Injected Knowledge.
Use JSON inject output to programmatically merge corpus snippets into a plan document.
Re-inject after updating learnings so the next fix cycle sees quality-gated entries only.
How it compares
CLI contract and test map for corpus injection—not a generic RAG SaaS integration.
Common Questions / FAQ
Who is inject for?
Solo and indie developers running agentops who need agents to pull .agents learnings via ao inject with a stable header and JSON option.
When should I use inject?
At Build kickoff before implementation, during Operate iterate when updating playbooks, and whenever JIT context must be filtered with --for for a specific skill.
Is inject safe to install?
Injection reads local .agents content; review the Security Audits panel on this page and audit learnings for secrets before enabling automatic inject in CI or prod workflows.
SKILL.md
READMESKILL.md - Inject
# Executable spec for the `ao inject` CLI command — the JIT knowledge-injection surface. # Specs the observable behavior of `ao inject`: the markdown/JSON output contract, the # empty-corpus header guarantee, skill-scoped filtering via --for (including the unknown-skill # error path), and the quality-gate filter on candidate learnings. Each scenario links to the # Go test in cli/cmd/ao/ that proves it. (soc-jnfgi) Feature: ao inject outputs relevant knowledge for explicit or JIT context As an agent assembling task context I want injected learnings, patterns, and sessions in a budgeted, scoped form So that prior knowledge is surfaced at the point of work in a stable contract @covered-by:cli/cmd/ao/inject_integration_test.go::TestInject_Integration_WithLearnings Scenario: inject surfaces local learnings under a stable markdown header Given the local .agents directory holds a learning and a pattern When I run `ao inject` Then the markdown output carries the "Injected Knowledge" header @covered-by:cli/cmd/ao/inject_integration_test.go::TestInject_Integration_EmptyLearningsDir Scenario: inject still emits the header and timestamp when no local learnings exist Given the local .agents corpus has no learnings or patterns When I run `ao inject` Then the output still contains the "Injected Knowledge" header and a "Last injection:" timestamp @covered-by:cli/cmd/ao/inject_integration_test.go::TestInject_Integration_JSONFormat Scenario: inject emits a structured JSON contract under --output json Given the local .agents corpus holds a learning When I run `ao --output json inject` Then the JSON output carries a "timestamp" field @covered-by:cli/cmd/ao/inject_test.go::TestInjectForFlag_ResearchSkill Scenario: --for filters output by the named skill's context declaration Given a skill whose context declaration excludes the HISTORY section When I run `ao inject --for=<skill>` Then the excluded section (Recent Sessions) is absent from the output @covered-by:cli/cmd/ao/inject_test.go::TestInjectForFlag_UnknownSkill Scenario: --for with an unknown skill is a hard error Given no skill matching the requested name exists When I run `ao inject --for=<nonexistent-skill>` Then the command fails with a "not found" error @covered-by:cli/cmd/ao/inject_test.go::TestProcessLearningFile_QualityGateFilters Scenario: the quality gate drops candidate learnings below the threshold Given a candidate learning whose quality is below the injection gate threshold When inject assembles its candidates Then the sub-threshold learning is filtered out of the result #!/usr/bin/env bash set -euo pipefail SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)" PASS=0; FAIL=0 check() { if bash -c "$2"; then echo "PASS: $1"; PASS=$((PASS + 1)); else echo "FAIL: $1"; FAIL=$((FAIL + 1)); fi; } check "SKILL.md exists" "[ -f '$SKILL_DIR/SKILL.md' ]" check "SKILL.md has YAML frontmatter" "head -1 '$SKILL_DIR/SKILL.md' | grep -q '^---$'" check "name is inject" "grep -q '^name: inject' '$SKILL_DIR/SKILL.md'" check "mentions knowledge" "grep -qi 'knowledge' '$SKILL_DIR/SKILL.md'" check "mentions .agents/ or session" "grep -qiE '\\.agents/|session' '$SKILL_DIR/SKILL.md'" echo ""; echo "Results: $PASS passed, $FAIL failed" [ $FAIL -eq 0 ] && exit 0 || exit 1 --- name: inject description: Load relevant .agents context. practices: - wiki-knowledge-surface - pragmatic-programmer hexagonal_role: driving-adapter consumes: [] produces: [] context_rel: [] skill_api_version: 1 user-invocable: false context: window: fork intent: mode: none sections: exclude: - TASK intel_scope: full metadata: tier: background dependencies: [] internal: true output_contract: 'stdout: injected knowledge summary' --- > **DEPRECATED (removal target: v3.0.0)** — Use `ao lookup --query "topic"` for on-demand learnings retrieval and phase-scoped context packets. This skill and the `ao inject