Cognitive Packets + SKC: A Persistent Memory Architecture for ICP-Native AI Agents

The problem nobody is solving

Every major agent framework today — LangChain, AutoGPT, Mobile-Agent, AppAgent — is amnesiac by design. Every session starts cold. Every task is stateless. The agent that successfully navigated a complex workflow yesterday has no memory it ever ran. This is not a minor inconvenience. It is a fundamental architectural ceiling that caps how capable any agent can ever become.

The agent community is obsessed with making models smarter. Almost nobody is asking the more durable question: how does an agent compound what it already knows across sessions?

Two primitives answer that question. And ICP is uniquely positioned to make them real.


Primitive 1 — Cognitive Packets

A Cognitive Packet is a typed, self-describing unit of agent cognition. Every meaningful step an agent takes gets captured as a structured record:

{
  task_id:     string,          // what goal this belongs to
  step:        u32,             // position in sequence
  percept:     PerceptData,     // what the agent observed
  action:      ActionData,      // what it did
  reasoning:   Text,            // compressed chain-of-thought
  outcome:     OutcomeData,     // what changed after the action
  confidence:  f32,             // model certainty 0.0–1.0
  dtype:       PacketType,      // Percept | Action | Decision | Error
}

This is not logging. Logs are inert. Cognitive Packets are replayable, composable, and transferable.

A successful task sequence becomes a reusable cognitive subroutine. A failed sequence becomes a labeled training signal. Packets from one agent can inform another agent running a similar task. The system gets measurably smarter with use — not just with retraining.


Primitive 2 — The Shared Knowledge Core (SKC)

Cognitive Packets need a home. The SKC is that home — a persistent, structured, sovereign memory layer that the agent consults at task start and writes to at task end.

Three layers:

Episodic — what happened. Past packet sequences indexed by task type and outcome. Lets the agent say “I’ve done this before, here’s what worked.”

Semantic — what things mean. Compressed, durable knowledge about the environment. Site-specific patterns, UI quirks, domain rules. Accumulated over time, not re-derived from scratch every session.

Preferential — what you want. The user’s behavioral fingerprint. Preferred options, habitual patterns, hard constraints. This is what makes the agent yours rather than generic.


Architecture diagram

┌─────────────────────────────────────────────────┐
│                   DEVICE LAYER                  │
│                                                 │
│  Perception  ──►  Agent Loop  ──►  Actions      │
│  (UI tree /        │    ▲         (tap/type/    │
│   screenshot)      │    │          scroll)      │
│                    ▼    │                       │
│            Cognitive Packet Builder             │
└────────────────────┬────────────────────────────┘
                     │ task start: pull context
                     │ task end:   push packets
                     ▼
┌─────────────────────────────────────────────────┐
│              ICP CANISTER (SKC)                 │
│                                                 │
│  ┌─────────────┐  ┌──────────────┐  ┌────────┐ │
│  │  Episodic   │  │   Semantic   │  │ Prefer │ │
│  │   Store     │  │    Store     │  │ential  │ │
│  │ (sequences) │  │  (env model) │  │ Store  │ │
│  └─────────────┘  └──────────────┘  └────────┘ │
│                                                 │
│         Owned by your principal.                │
│         Always online. Tamper-evident.          │
└─────────────────────────────────────────────────┘
                     │
                     ▼
         Other agent instances
         (desktop / trading / research)
         all sync through ONE canister

Why ICP is the right home — not just a convenient one

Most agent memory today is a vector DB on someone’s rented server. It disappears when you stop paying. The provider can read it. It breaks when you switch devices. It has no integrity guarantees.

An SKC in an ICP canister is fundamentally different:

  • Orthogonal persistence — stable memory survives canister upgrades without explicit serialization. Your agent’s cognitive state is durable by default.
  • Sovereign principal — the SKC is owned by your Internet Identity, not a cloud provider. The agent has an identity, a wallet, and a memory in one unit.
  • Tamper-evident — the agent’s history has integrity guarantees. Auditable by design.
  • Always online — survives phone wipes, app reinstalls, device changes.
  • Multi-agent ready — phone agent, desktop agent, trading agent all reading from and writing to the same SKC canister. One coherent world model across all instances.

The canister doesn’t sit in the real-time agent loop — latency would kill that. It is consulted at task start to load relevant context, and written to at task end to commit what happened. That is exactly the access pattern ICP handles well.


What this unlocks

The compounding effect is the core value proposition. An agent that has run 1,000 browsing tasks has 1,000 packet sequences to draw from. It knows which approaches fail on which sites. It knows your preferences without being told. It gets better asymptotically in a way that a stateless agent cannot. That is a genuine moat — and it grows with use rather than with capital.

This is also the correct framing for ICP’s value in the AI agent stack. Not “ICP as compute for AI” — that’s a hard sell against GPU clouds. But ICP as the sovereign memory and coordination layer for autonomous agents — that’s a differentiated position nobody else can credibly claim.


Where this connects to what you’re already building

The AGENTS.md work in icp-cli-templates is essentially the beginning of this: giving agents structured, on-demand access to ICP-specific knowledge at task time. That’s a shallow SKC. Cognitive Packets + a full SKC canister is the deep version — not just “here are the docs” but “here is everything this agent has learned, typed and indexed and owned by the user.”

These two efforts point in the same direction.


Open questions for the community

Is anyone building in this direction on ICP? Specifically:

  • Has anyone implemented structured agent memory in stable storage / stable structures?
  • Is there existing work on typed action logs or replayable agent traces on ICP?
  • Would a reference SKC canister implementation (Motoko or Rust) be useful as a community primitive?

Happy to go deeper on the packet schema, the canister interface design, or the retrieval layer. This feels like something worth building together.

@DFINITYTeamMembers