inject
Load relevant .agents context.
What this skill does
> **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` CLI command still work as compatibility adapters, but they are not the canonical context path and are not called from default hooks or other skills.
# Inject Skill
**On-demand knowledge retrieval. Not run automatically at startup (since ag-8km).**
It is read-only: it only reads knowledge for injection and never writes to `.agents/`.
Load relevant prior knowledge into the current session as a legacy adapter.
## Lease
| Field | Value |
|---|---|
| Lease | retire-candidate |
| Replacement port | `retrieve_context` / `assemble_context` |
| Replacement adapters | `ao lookup`, knowledge brief artifacts |
| Current allowed use | manual compatibility lookup only |
| Not allowed | default startup injection, hidden hook delivery, task planning |
## How It Works
In the default hookless startup path, no startup injection occurs. Run `ao session bootstrap` for the standard orientation report, then prefer `ao lookup` / `ao inject` for on-demand retrieval and bounded per-phase packets. Use `/inject` or `ao inject` only for legacy compatibility.
If you author an opt-in SessionStart hook or run a legacy hook profile, it may call:
```bash
# lean mode (MEMORY.md fresh): 400 tokens
ao inject --apply-decay --format markdown --max-tokens 400 \
[--bead <bead-id>] [--predecessor <handoff-path>]
# legacy mode: 800 tokens
ao inject --apply-decay --format markdown --max-tokens 800 \
[--bead <bead-id>] [--predecessor <handoff-path>]
```
This legacy path searches for relevant knowledge and prints a bounded summary.
### Work-Scoped Injection
When `--bead` is provided (via `HOOK_BEAD` env var from Gas Town):
- Learnings tagged with the same bead ID get a 1.5x score boost
- Learnings matching bead labels get a 1.2x boost
- Untagged learnings still appear but ranked lower
### Predecessor Context
When `--predecessor` is provided (path to a handoff file):
- Extracts structured context: progress, blockers, next steps
- Injected as "Predecessor Context" section before learnings
- Supports explicit handoffs, auto-handoffs, and pre-compact snapshots
## Manual Execution
Given `/inject [topic]`:
### Step 1: Search for Relevant Knowledge
**With ao CLI:**
```bash
ao lookup --query "<topic>" --limit 5
```
**Without ao CLI, search manually:**
```bash
# Global operating memory
sed -n '1,120p' ~/.agents/MEMORY.md 2>/dev/null
# Recent learnings
ls -lt .agents/learnings/ | head -5
# Recent patterns
ls -lt .agents/patterns/ | head -5
# Recent research
ls -lt .agents/research/ | head -5
# Global learnings (cross-repo knowledge)
ls -lt ~/.agents/learnings/ 2>/dev/null | head -5
# Global patterns (cross-repo patterns)
ls -lt ~/.agents/patterns/ 2>/dev/null | head -5
# Legacy patterns (read-only fallback, no new writes)
ls -lt ~/.claude/patterns/ 2>/dev/null | head -5
```
### Step 2: Read Relevant Files
Use the Read tool to load the most relevant artifacts based on topic.
### Step 3: Summarize for Context
Present the injected knowledge:
- Global principles or constraints that apply everywhere
- Key learnings relevant to current work
- Patterns that may apply
- Recent research on related topics
### Step 4: Record Citations (Feedback Loop)
After presenting injected knowledge, record which files were injected for the feedback loop:
```bash
mkdir -p .agents/ao
# Record each injected learning file as a citation
for injected_file in <list of files that were read and presented>; do
echo "{\"artifact_path\": \"$injected_file\", \"cited_at\": \"$(date -Iseconds)\", \"session_id\": \"$(date +%Y-%m-%d)\", \"workspace_path\": \"$PWD\"}" >> .agents/ao/citations.jsonl
done
```
Citation tracking enables the feedback loop: learnings that are frequently cited get confidence boosts during `/post-mortem`, while uncited learnings decay faster.
## Knowledge Sources
| Source | Location | Priority | Weight |
|--------|----------|----------|--------|
| Global Memory | `~/.agents/MEMORY.md` | Highest | 1.0 |
| Learnings | `.agents/learnings/` | High | 1.0 |
| Patterns | `.agents/patterns/` | High | 1.0 |
| Global Learnings | `~/.agents/learnings/` | High | 0.8 (configurable) |
| Global Patterns | `~/.agents/patterns/` | High | 0.8 (configurable) |
| Research | `.agents/research/` | Medium | — |
| Retros | `.agents/learnings/` | Medium | — |
| Legacy Patterns | `~/.claude/patterns/` | Low | 0.6 (read-only, no new writes) |
## Decay Model
Knowledge relevance decays over time (~17%/week). More recent learnings are weighted higher.
## Key Rules
- **Does not run automatically** - default context delivery is explicit
- **Context-aware** - filters by current directory/topic
- **Token-budgeted** - respects max-tokens limit
- **Recency-weighted** - newer knowledge prioritized
## Examples
### Opt-In Hook Profile Invocation (legacy only)
**Hook trigger:** an externally authored or legacy `session-start.sh` may run at session start with `AGENTOPS_STARTUP_CONTEXT_MODE=lean` or `legacy`
**What happens:**
1. Hook calls `ao inject --apply-decay --format markdown --max-tokens 400` (lean) or `--max-tokens 800` (legacy)
2. CLI searches `.agents/learnings/`, `.agents/patterns/`, `.agents/research/` for relevant artifacts
3. CLI applies recency-weighted decay (~17%/week) to rank results
4. CLI outputs top-ranked knowledge as markdown within token budget
5. Agent presents injected knowledge in session context
**Result:** Prior learnings, patterns, and research are available for legacy hook profiles. This is not the default AgentOps 3.0 path.
**Note:** In the default hookless path, run `ao session bootstrap` and then pull context explicitly with `ao lookup` or `ao inject`.
### Manual Context Injection
**User says:** `/inject authentication` or "recall knowledge about auth"
**What happens:**
1. Agent calls `ao lookup --query "authentication" --limit 5`
2. CLI filters artifacts by topic relevance
3. Agent reads top-ranked learnings and patterns
4. Agent summarizes injected knowledge for current work
5. Agent references artifact paths for deeper exploration
**Result:** Topic-specific knowledge retrieved and summarized, enabling faster context loading than full artifact reads.
## Troubleshooting
| Problem | Cause | Solution |
|---------|-------|----------|
| No knowledge injected | Empty knowledge pools or ao CLI unavailable | Run `/post-mortem` to seed pools; verify ao CLI installed |
| Irrelevant knowledge | Topic mismatch or stale artifacts dominate | Use `--context "<topic>"` to filter; prune stale artifacts |
| Token budget exceeded | Too many high-relevance artifacts | Reduce `--max-tokens` or increase topic specificity |
| Decay too aggressive | Recent learnings not prioritized | Check artifact modification times; verify `--apply-decay` flag |
## Knowledge Activation (merged from `knowledge-activation`, cp-auc)
`inject` and `ao lookup` *retrieve* knowledge for the current session. **Activation** is the complementary capability — folded in here from the former `knowledge-activation` skill — that *operationalizes* a mature `.agents` corpus into durable operator surfaces (beliefs, playbooks, briefings, gaps). Where `inject` reads, activation promotes; the two are the read and write-to-surface halves of the same flywheel. Activation is the **fourth step** of the global-corpus workflow:
1. `$curate --mode=harvest` — gather artifacts from many rigs into `~/.agents/learnings/`
2. `$compile` — synthesize raw artifacts into `.agents/compiled/`
3. *(optional)* `$curate --mode=dream` overnight — bounded compounding loop
4. **knowledge activation** — lift compiled knowledge into playbooks, beliefs, and runtime briefings
`$compile` remains the hygiene loop; activation owns corpus operationalization. Use it when the problem is no longer "capture more knowledge" but: promote the strongest recurring claims into a belief system, Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.