# Context Anchor

> Drop a working reference at any point in a session to prevent cascading context drift. Use when switching tasks, resuming after a break, or handing off between agents.

- Skill: `harshsinghmp/context-anchor` (Agent Skill, multi-file: 6 files)
- Install (CLI): `npx skillmds@latest add harshsinghmp/context-anchor`
- Raw SKILL.md: https://api.skillmd.com/api/skills/harshsinghmp/context-anchor/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: harshsinghmp (https://skillmd.com/u/harshsinghmp)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/harshsinghmp/context-anchor

---


# ⚓ context-anchor — Working Reference Snapshot Generator

Drop a compact working reference snapshot in `<project-root>/.agents/anchor.md` to prevent cascading context drift across long sessions, breaks, or task switches.

---

## When to Use

- Before switching tasks or workstreams mid-session.
- Before delegating a subtask to another agent.
- At the start of a session when previous context is cold or stale.
- Whenever you catch yourself re-reading dozens of messages to recall system state.

---

## Quick Reference

| Section | Content Requirement | Length Constraint |
|:---|:---|:---|
| **What's True Right Now** | Active state, key decisions made, and ruled-out paths | 2–4 bullet points |
| **The Working Reference** | Single sentence that an agent can act upon immediately | Exactly 1 sentence |
| **Next Action** | Single atomic next step with file and line reference | Exactly 1 task item |

---

## Procedure

### Step 1: Scan Active Session
Identify:
1. What was being built / fixed / investigated.
2. What decisions were finalized and why.
3. What was tried and ruled out.
4. The exact next concrete step.

### Step 2: Write Context Anchor
Save to `<project-root>/.agents/anchor.md`:

```markdown
# Context Anchor — <ISO timestamp>

## What's True Right Now
- [1-sentence state of active work]
- [Key decision made: what and why]
- [What was tried and ruled out]

## The Working Reference
> [One sentence that a fresh agent can act on immediately without asking questions.]

## Next Action
- [ ] `path/to/file.ts:line` — [Exact atomic action]
```

### Step 3: Echo Anchor
Display the anchor to the user for instant alignment.

---

## Pitfalls

- **Verbosity & Noise**: Every line must be load-bearing. Delete filler.
- **Vague Next Actions**: Never write *"continue coding"*; specify the exact file, line number, and function.
- **Missing Decisions Rationale**: Always include the *"why"* for architectural decisions so future agents don't revert them.

---

## Verification

- Confirm `<project-root>/.agents/anchor.md` exists and is formatted cleanly.
- Confirm Next Action points to an exact concrete file and line number.

