
Cognitive Scaffolding
Reorder and chunk what goes into the agent context so critical facts land where the model actually attends—primacy and recency—not buried in the middle.
Overview
Cognitive Scaffolding is a journey-wide agent skill that structures context windows using primacy, recency, chunking, and attention allocation so solo builders get sharper agent reasoning without changing models.
Install
npx skills add https://github.com/itallstartedwithaidea/agent-skills --skill cognitive-scaffoldingWhat is this skill?
- Applies primacy and recency effects so high-stakes instructions and constraints sit at context boundaries
- Uses chunking and attention allocation to group related facts instead of dumping flat blobs
- Improves recommendation quality when the same data is placed strategically vs arbitrarily (validated on production agent
- Generalizes across campaign analysis, code context, and documentation—not one integration
- Part of the Agent Skills™ line from itallstartedwithaidea / googleadsagent.ai
Adoption & trust: 1 installs on skills.sh; 18 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
You pack the same facts into the agent but get inconsistent or shallow answers because critical details sit in the low-attention middle of a long context.
Who is it for?
Builders who run long agent sessions with mixed docs, logs, and specs and want a repeatable layout pattern instead of hoping the model “notices” everything.
Skip if: Teams that already use a fixed, audited prompt template with proven metrics and do not want to reorder context per task.
When should I use this skill?
Whenever an agent must reason over long or mixed context—code, docs, metrics—and results feel unreliable despite complete information.
What do I get? / Deliverables
After scaffolding, the agent’s prompt reads as ordered, boundary-weighted chunks so recommendations and code edits track your constraints and data more reliably.
- A reordered context layout with boundary-weighted critical blocks
- Chunked supporting material grouped by topic or file
Recommended Skills
Journey fit
Useful at every journey phase - explore requirements and options before committing to a direction.
Where it fits
Place API contracts and invariants at the top and acceptance tests at the bottom before asking the agent to implement a feature.
Chunk a PR diff with severity rubric first and file-local notes grouped by module so review comments stay consistent.
Lead with target query intent and brand voice, middle with evidence links, close with publish checklist for GEO/SEO copy drafts.
Open with current user impact and SLO, middle with log excerpts by service, end with hypothesized fixes and verification steps.
How it compares
Use instead of dumping retrieved files in retrieval order—this is prompt architecture, not a RAG connector or MCP server.
Common Questions / FAQ
Who is cognitive-scaffolding for?
Solo and indie builders who depend on coding agents for analysis, implementation, and ops work and control what lands in each turn’s context.
When should I use cognitive-scaffolding?
Use it in Build when assembling multi-file refactors, in Ship during review prep when pasting diffs plus standards, in Launch when summarizing SEO or distribution briefs for the agent, in Grow when structuring analytics narratives, and in Operate when feeding incident timelines—a
Is cognitive-scaffolding safe to install?
It is instructional layout guidance with no inherent shell or network behavior; review the Security Audits panel on this Prism page before installing any skill from the repo.
SKILL.md
READMESKILL.md - Cognitive Scaffolding
# Cognitive Scaffolding Part of [Agent Skills™](https://github.com/itallstartedwithaidea/agent-skills) by [googleadsagent.ai™](https://googleadsagent.ai) ## Description Cognitive Scaffolding structures an agent's context window using principles from cognitive science — primacy effects, recency bias, chunking, and attention allocation. Language models, like human working memory, are not uniform processors. Information placed at the beginning and end of the context receives disproportionate attention (primacy and recency effects), while content in the middle can be effectively invisible. Cognitive Scaffolding exploits these properties to ensure the most critical information receives maximum model attention. This skill was developed through extensive experimentation on the Buddy™ agent at [googleadsagent.ai™](https://googleadsagent.ai), where analysis accuracy improved by measurable margins simply by restructuring how information was arranged in the context window. Campaign performance data placed at strategic positions within the prompt produced significantly better recommendations than the same data placed arbitrarily. The same principle applies to code context, documentation, and any other information an agent must reason over. The cognitive scaffolding framework organizes context into four zones: the anchor zone (first 5% of context — highest attention, used for identity and immutable rules), the foreground zone (last 20% — high attention, used for the current task and recent context), the structured middle (60% — moderate attention, organized into clearly delimited chunks), and the background zone (15% — lowest attention, used for reference material and fallbacks). Each zone has specific content strategies that maximize the model's ability to utilize the information placed there. ## Use When - Agent accuracy varies inconsistently despite using the same information - Long context windows degrade performance compared to shorter interactions - Critical instructions or constraints are occasionally ignored by the agent - You need to present large amounts of reference data without overwhelming the agent - Multi-document reasoning requires the agent to attend to specific sections - You are optimizing agent behavior for specific model architectures ## How It Works ```mermaid graph LR subgraph "Context Window" A[Anchor Zone<br/>5% - Highest Attention<br/>Identity, Rules] --> B[Structured Middle<br/>60% - Chunked Data<br/>Delimited Sections] B --> C[Background Zone<br/>15% - Reference<br/>Fallback Material] C --> D[Foreground Zone<br/>20% - Current Task<br/>Recent Messages] end E[Primacy Effect] -.-> A F[Chunking Theory] -.-> B G[Low Attention Region] -.-> C H[Recency Effect] -.-> D ``` The scaffolding exploits well-documented attention patterns in transformer architectures. The anchor zone leverages primacy — the model attends strongly to the earliest tokens, making this the ideal location for identity statements and non-negotiable rules. The foreground zone leverages recency — the most recent tokens receive high attention, making this the best place for the current task and recent conversation. The structured middle uses explicit delimiters and headers to create navigable chunks that compensate for the "lost in the middle" effect. The background zone stores material the model can reference but doesn't need to actively attend to. ## Implementation **Cognitive Zone Builder:** ```typescript interface CognitiveZone { name: string; position: "anchor" | "middle" | "background" | "foreground"; budgetPercent: number; content: string; delimiter: string; } class CognitiveScaffold { private totalBudget: number; private zones: Map<string, Cogniti