Skip to content
Back to skills

Context And Continuity

ASecurity

Manage context pressure, configure message windowing, and use checkpoint tools to preserve critical findings across context compaction.

  • 33 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 11, 2026
ai-agentstypescriptgoreactapi

Works with

  • api

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add tylerjrbuell/reactive-agents-ts --skill context-and-continuity --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Context And Continuity?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Context And Continuity
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tylerjrbuell-context-and-continuity/badge)](https://www.skillsdirectory.com/skills/tylerjrbuell-context-and-continuity)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: context-and-continuity
description: Manage context pressure, configure message windowing, and use checkpoint tools to preserve critical findings across context compaction.
compatibility: Reactive Agents TypeScript projects using @reactive-agents/*
metadata:
  author: reactive-agents
  version: "2.0"
  tier: "capability"
---

# Context and Continuity

## Agent objective

Produce an agent that survives long tasks without losing key findings — correct windowing configuration, explicit checkpoint tool usage, and cross-session memory where needed.

## When to load this skill

- Task is long-running (10+ iterations expected)
- Agent must preserve intermediate results across context pressure events
- Agent needs to resume work across sessions
- Task involves accumulating findings that must survive to the final answer

## Implementation baseline

```ts
const agent = await ReactiveAgents.create()
  .withProvider("anthropic")
  .withReasoning({ defaultStrategy: "adaptive", maxIterations: 20 })
  .withTools({
    allowedTools: ["web-search", "file-read", "checkpoint", "recall", "find"],
  })
  .withMemory({ tier: "enhanced", dbPath: "./agent.db" })
  .withSystemPrompt(`
    You are a research assistant.
    Use the checkpoint tool to save key findings before moving on.
    Call checkpoint() with no args to review what you've saved.
  `)
  .build();
```

## Key patterns

### Using the checkpoint tool

The `checkpoint` tool has three modes:

```ts
// SAVE — persist a named finding
checkpoint("api-endpoints", "Found: /users, /orders, /products at base URL https://api.example.com")

// RETRIEVE — get a saved finding by name
checkpoint("api-endpoints")

// LIST — show all saved checkpoints
checkpoint()
```

Instruct the agent explicitly in the system prompt:

```ts
.withSystemPrompt(`
  After each major discovery, call checkpoint(label, content) to save it.
  Before writing your final answer, call checkpoint() to review all saved findings.
  Never rely on context alone for facts you found more than 3 steps ago.
`)
```

### Context pressure thresholds

The kernel auto-checkpoints and applies message windowing based on token utilization:

| Tier | Hard gate | Auto-checkpoint fires at |
|------|-----------|--------------------------|
| `local` | 80% | 75% |
| `mid` | 85% | 80% |
| `large` | 90% | 85% |
| `frontier` | 95% | 90% |

Auto-checkpoint captures successful non-meta tool observations. It is a safety net — **explicit checkpoints for structured findings are better**.

### Tool schemas: the largest part of each request

Tool schemas often take most of an iteration's input (an iteration is one model turn). `.withTools({ disclosure, schemaBudget })` sizes them:

```ts
.withTools({
  disclosure: "auto",   // default on local and mid; large and frontier default to "discover"
  schemaBudget: 4000,   // tokens for the tools array per iteration (default; integer >= 500)
  focusedTools: ["web-search"], // always shipped in full
})
```

- `"auto"`: needed tools (required, focused, already called, discovered, the agent's own `defineTool` tools and opted-in built-ins) ship full even over the budget; a tool whose last call failed argument validation ships full next turn; other tools ship compact (no descriptions; types, `required`, enums and constraints kept) by task relevance while they fit; the rest are one-line tool-index entries the model can call by name. On the `local` tier needed tools ship compact.
- `"all"`: every tool full, budget ignored. `"discover"`: no domain schemas until the model calls `discover-tools` (an extra iteration).
- Default per tier: `"auto"` on `local` and `mid`, `"discover"` on `large` and `frontier` (no tier: `local` on Ollama, else `mid`). Set `"auto"` explicitly to use the budget on large and frontier models.
- `"index"` is a deprecated alias of `"auto"`.
- Each iteration's `tool-surface-resolved` trace event carries `allocation` (per-tool `presentation`, `reason`, `tokens`, plus `spent`, `budget`, `overrun`); `run-started.config.disclosure` records `{ mode, source, schemaBudget }`.
- Token savings depend on the catalog and model. One live A/B (wiki/Research/Harness-Reports/2026-12-01-tool-schema-allocator-ablation-rerun.md) cut billed tokens about 63% on two paid models and not at all on qwen3:4b. Do not promise a number.

### Cross-session memory with `.withMemory()`

```ts
// Within-session only (default)
.withTools({ allowedTools: ["checkpoint"] })

// Cross-session persistence — findings survive agent restarts
.withMemory({ tier: "enhanced", dbPath: "./research-memory.db" })
.withTools({ allowedTools: ["checkpoint", "recall", "find"] })
// recall — semantic search over past episodic memory
// find — exact lookup by memory key
```

### Seeing what memory recalled

Each bootstrap that recalls something publishes a `MemoryRecalled` event on the EventBus: one per non-empty tier (`semantic`, `episodic`, `procedural`) with the `taskId`, `agentId` and up to 20 items (`id`, `tier`, a summary truncated to 160 characters, plus `importance` or `score`). A bootstrap that recalls nothing publishes nothing.

### Post-run debrief with `.withDebrief()`

The debrief has its own switch, independent of memory. Unset, it follows `.withMemory()`. `.withDebrief()` turns it on with memory off (only the debrief table is written); `.withDebrief(false)` turns it off with memory on.

### Reducing context pressure on long tasks

```ts
// Lower maxIterations forces tighter reasoning loops
.withReasoning({ defaultStrategy: "adaptive", maxIterations: 12 })

// Use plan-execute-reflect to front-load planning and avoid re-exploring
.withReasoning({ defaultStrategy: "plan-execute-reflect", maxIterations: 15 })
```

## Builder API reference

| Method | Key params | Notes |
|--------|-----------|-------|
| `.withTools({ allowedTools })` | include `"checkpoint"`, `"recall"`, `"find"` | Checkpoint is a built-in meta-tool |
| `.withTools({ disclosure, schemaBudget })` | `"auto"` (default on local and mid) \| `"all"` \| `"discover"` (default on large and frontier); budget default 4000 | Sizes the tools array per iteration; `schemaBudget` < 500 or non-integer throws `ToolsOptionError` |
| `.withMemory(opts?)` | `{ tier: "enhanced", dbPath }` | Episodic + semantic memory persist across sessions |
| `.withReasoning({ maxIterations })` | number | Lower = tighter loops = less context pressure |
| `.withSystemPrompt(s)` | string | Instruct agent to use checkpoint tool proactively |

## Pitfalls

- Auto-checkpoint captures tool observations only — it won't save the agent's reasoning or intermediate conclusions; use explicit `checkpoint(label, content)` for those
- Checkpoint labels must be unique within a session — reusing a label overwrites the previous value
- `.withMemory({ tier: "enhanced" })` without `dbPath` uses a default path; set explicitly in multi-agent environments to prevent collisions
- `recall` and `find` tools require `.withMemory()` — enabling them without memory configured is a no-op
- Context windowing is automatic; you cannot configure the window size directly — control pressure through iteration budget and explicit checkpointing instead

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.