perf(agent): reuse session context

This commit is contained in:
Matt Faltyn
2026-09-11 11:56:34 +02:00
committed by xarmian
parent 8e5b43ded5
commit d6e4053aca
5 changed files with 14 additions and 7 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ pad server info # How this client is connected to Pad
### For AI Agents
**Your agent becomes a project partner.** Install the `/pad` skill once, and your AI coding tool can read, create, and update project items through natural language. Cursor, Codex, Windsurf, and OpenCode receive a compact dispatcher and load detailed guidance by topic with `pad agent guide`, keeping routine turns small.
**Your agent becomes a project partner.** Install the `/pad` skill once, and your AI coding tool can read, create, and update project items through natural language. Cursor, Codex, Windsurf, and OpenCode receive a compact dispatcher, reuse bootstrapped context within a conversation, and load detailed guidance by topic with `pad agent guide`, keeping routine turns small.
```bash
pad agent install # Auto-detects your tools and installs the skill
+1 -1
View File
@@ -27,7 +27,7 @@ func TestAgentSkillPromptBudget(t *testing.T) {
if len(payload) > agentSkillPromptBudget {
t.Fatalf("%s installed skill payload is %d bytes; budget is %d", agent, len(payload), agentSkillPromptBudget)
}
for _, required := range []string{"pad bootstrap", "issue IDs", "convention_index", "pad agent guide"} {
for _, required := range []string{"pad bootstrap", "do not rerun bootstrap", "issue IDs", "convention_index", "pad agent guide"} {
if !contains(string(payload), required) {
t.Errorf("%s installed skill is missing core guidance %q", agent, required)
}
+7 -4
View File
@@ -91,11 +91,14 @@ const agentsSkillBody = `# Pad — Talk to Your Project
Use Pad when the user discusses project work: issues, tasks, plans, ideas,
progress, dependencies, conventions, roles, standups, or retrospectives.
## Start every invocation
## Load context once per conversation
Run ` + "`pad bootstrap --format json`" + ` before acting. It returns the workspace,
user, collections and schemas, always-on conventions, convention index, roles,
playbooks, dashboard, and recent activity in one call.
Before the first Pad action in a conversation, run ` + "`pad bootstrap --format json`" + `.
Reuse that context for later Pad turns in the same workspace. Refresh it only
after switching workspaces, after changing collections/conventions/roles/playbooks,
when Pad reports stale schema/context, or when the user asks for a refresh. Use a
targeted item or dashboard read for changing work state; do not rerun bootstrap
just because the skill was invoked again.
- If ` + "`pad`" + ` is missing, ask the user to install it or add it to PATH.
- If bootstrap fails, run ` + "`pad agent guide context-loading`" + ` and follow that
+2
View File
@@ -58,6 +58,8 @@ Read these directly when you need workspace state:
Resources support host-side prefetch — if the host can fetch them once at session start, you don't pay per turn.
Load the bootstrap resource once per workspace and reuse its collections, conventions, roles, and playbook metadata. Refresh it after switching workspaces, after changing those configuration surfaces, when Pad reports stale schema/context, or when the user asks. For changing work state, read the affected item or use a targeted project tool instead of fetching the whole bootstrap again.
## Workspace context
Every action that operates within a workspace accepts an optional `workspace` parameter. Resolution order:
+3 -1
View File
@@ -21,12 +21,14 @@ There is **one entry point**: the user talks to you about their project, and you
## Context Loading
On every invocation of this skill — however the user's surface reached it — start by loading workspace context with a single call:
Before the first Pad action in a conversation, load workspace context with a single call:
```bash
pad bootstrap --format json # one round-trip: workspace + user + collections + always-on conventions + roles + playbook metadata + dashboard + recent activity
```
Reuse that bootstrap context for later Pad turns in the same workspace. Refresh it only after switching workspaces, after changing collections/conventions/roles/playbooks, when Pad reports stale schema or context, or when the user explicitly asks for a refresh. Ordinary item changes make the snapshot's dashboard stale, but do not require another full bootstrap — read the affected item or run the targeted project query instead. Do not rerun bootstrap merely because the skill was invoked again.
The returned `AgentBootstrap` blob carries everything the skill needs to start a session:
- `workspace { slug, name, id }` — who you're talking to about