Why I Built PCSKit: Solving Context Loss in AI Coding Sessions

AI coding agents are productive, but their work can lose continuity when a context window fills up, a session gets interrupted, or developers switch between tools. I built PCSKit to solve this problem with local-first project continuity, evidence-based handoffs, and verifiable development history—so the next AI agent can continue from the actual project state instead of relying on an unreliable summary.

Kumar NihalNovember 24, 202610 min read
On this page

Why I Built PCSKit: Solving Context Loss in AI Coding Sessions

I spend a lot of time building software with AI coding agents. They help me implement features, explore codebases, debug issues, and work through complicated development tasks.

But over time, I noticed a recurring problem.

An AI coding agent could spend hours working on a project, understand its architecture, make changes, and get close to completing a task. Then its context window would fill up, a session would end, or I would switch to another agent.

And suddenly, the next session had to figure out where the previous one had stopped.

The code was still there. Git history was still there. But the working context was gone.

That was the problem that led me to build PCSKit — Project Continuity Kit.

Website: https://pcskit.causly.in/

GitHub: https://github.com/KNIHAL/pcskit

The Problem: AI Coding Agents Lose Context Between Sessions#

AI coding agents are becoming an important part of software development workflows. Developers use tools like Claude Code, Cursor, and other AI-powered coding environments to work on real projects.

However, these agents operate within sessions and context windows.

When a session ends, the next session doesn't automatically know everything that happened before.

Consider a typical development workflow:

  1. You ask an AI agent to implement a feature.
  2. It explores the codebase and makes several changes.
  3. You discuss architectural decisions and resolve implementation issues.
  4. The agent reaches its context limit or the session gets interrupted.
  5. You open another session or switch to a different AI coding agent.

Now the new agent needs to understand:

  • What was the original task?
  • Which parts were completed?
  • Which files were modified?
  • What decisions were made?
  • Which tests were executed?
  • What is still unfinished?
  • What should happen next?

The repository contains much of the technical state, but it doesn't necessarily explain the working history or the decisions behind it.

This creates a continuity problem.

Why a Simple Context Summary Wasn't Enough#

The usual solution is to ask the previous agent to create a summary or a HANDOFF.md file.

It can include completed tasks, modified files, unresolved issues, and next steps.

That's useful, but I started noticing a fundamental weakness.

The handoff itself is written by the same agent whose work needs to be checked.

An agent might report that a task is complete even when it hasn't been verified. It might say that tests passed without having executed them. It might also miss changes made shortly before the session ended.

The next agent then receives a summary of what supposedly happened, rather than a reliable record of what actually happened.

I didn't want to build another tool that simply generated better summaries.

I wanted to solve the underlying problem: how can the next agent distinguish observed facts from claims made by the previous agent?

The Idea Behind PCSKit: Project Continuity Through Evidence#

PCSKit is a local-first command-line tool and MCP server designed to preserve project continuity across AI coding sessions.

Its purpose is to reconstruct the project's working state using Git observations and recorded evidence, then provide the next agent with a structured handoff.

Instead of depending entirely on an AI-generated summary, PCSKit records information while agents work.

When a session ends, it assembles a handoff from that evidence. When another agent resumes the project, PCSKit checks the handoff against the recorded state.

The central idea is simple:

Don't just preserve what an AI agent remembers. Preserve what the system actually observed.

How PCSKit Works#

I designed PCSKit around a few important components.

1. Session Tracking#

PCSKit records development sessions and associates activity with the agent working on the project.

This helps establish which session was active, when it started, and how it ended.

For example, when an agent reaches a token limit, the session can be recorded with that reason rather than being incorrectly described as successfully completed.

2. Git Snapshots and Repository State#

PCSKit observes Git state and records repository snapshots.

These snapshots help identify:

  • Current branch and commit.
  • Modified and untracked files.
  • Changes between snapshots.
  • Repository state at different points in a session.

This gives the next agent a better understanding of what changed instead of relying only on a written description.

3. Evidence-Based Task Verification#

One of the most important design decisions was separating agent claims from independently observed evidence.

PCSKit uses three provenance labels:

  • Verified: PCS observed the information itself.
  • Reported: An agent or person claimed something, but PCS did not independently verify it.
  • Inferred: PCS reached a conclusion from other available information.

For example, if an agent says a feature is complete, that statement remains reported.

If PCS executes a test command and records its exit code, the test run is verified.

A task can be treated as verified only when a passing test run executed by PCS is linked to it and the repository fingerprint still matches the state observed during that run.

This distinction prevents an agent's completion claim from automatically becoming proof.

4. Test Runs and Code Drift Detection#

A passing test result doesn't always mean the current code is working.

Imagine this sequence:

  1. An agent modifies a file.
  2. PCS executes the test suite.
  3. The tests pass.
  4. The agent makes additional changes.
  5. The session ends.

The previous passing result belongs to an older code state.

PCSKit records the repository state associated with a test run so that it can distinguish a current passing result from a stale one.

Its handoff separates tasks with matching passing evidence, tasks with passing evidence from an older code state, and tasks reported as complete without a linked passing run.

This gives the next agent a more accurate picture of what still needs verification.

5. Tamper-Evident Evidence History#

PCSKit also maintains an append-only evidence log using a SHA-256 hash chain.

Each event is linked to the previous event. The pcs verify command checks the integrity of that history and detects modifications, deletions, and reordering within the chain.

For stronger verification, PCSKit supports signed anchors stored outside the project.

This matters because a continuity record is only useful if its history can be checked.

6. Recovery When an Agent Stops Unexpectedly#

Another important design consideration was handling interrupted sessions.

What happens if an agent crashes or reaches its context limit before it can write a handoff?

PCSKit can reconstruct a handoff from its recorded evidence log.

The interruption is labelled as inferred when the system cannot independently know why the session stopped.

This means continuity doesn't have to depend entirely on the previous agent remembering to write a final summary.

Why I Chose a Local-First Architecture#

I wanted PCSKit to work alongside development projects without requiring developers to send their project history to an external service.

So I chose a local-first architecture.

PCSKit stores its project data inside a .pcs/ directory, which is excluded from Git tracking.

It uses SQLite through Node.js's built-in node:sqlite, avoiding an additional native database build step.

A few important architectural decisions:

  • No cloud account is required.
  • No network access or telemetry is used by PCSKit.
  • Each project maintains its own continuity data.
  • Sensitive files such as .env files and keys are listed by name but never opened during snapshots.
  • Recorded event payloads are redacted before storage.
  • Git observations use a hardened, read-only adapter.

Local-first doesn't automatically mean risk-free. Redaction is pattern-based, and developers should configure additional rules for their own secrets. The integrity model also has explicit limits, which is why external signed anchors are supported.

I wanted these boundaries to be clear rather than promise security that a local tool cannot guarantee.

Why I Built PCSKit as Both a CLI and an MCP Server#

I didn't want developers to change their entire workflow just to use a continuity tool.

That's why PCSKit provides a command-line interface and an MCP server.

The CLI lets developers manage sessions, tasks, notes, snapshots, test runs, handoffs, and evidence directly.

The MCP server allows compatible AI coding clients to interact with PCSKit through tools.

It currently provides integration paths for:

  • Claude Code
  • Claude Desktop
  • Cursor
  • Other MCP-compatible clients

Claude Code can also use hooks to start, checkpoint, and end sessions automatically.

For clients without hooks, PCSKit can install instruction blocks into supported agent instruction files.

The idea is to make project continuity part of the development workflow rather than another manual documentation task.

What Using PCSKit Looks Like#

The basic workflow is straightforward.

First, install PCSKit:

bash
npm install -g @knihal/pcskit

Initialize it inside your project:

bash
cd your-project
pcs init

Connect an AI coding client:

bash
pcs connect claude-code
pcs connect cursor

Install agent instructions and Claude Code hooks if needed:

bash
pcs agents install
pcs hooks install

Now PCSKit can record development activity.

A simplified session might look like this:

bash
pcs session start --agent claude

pcs note add task "Add the JSON export flag"

pcs test --task <task-id> -- npm test

pcs note add next "Connect the flag to the CLI entry"

pcs session end --reason limit

pcs handoff

When another agent takes over:

bash
pcs resume --agent cursor

PCSKit checks the handoff against the evidence log, observes the repository, and warns if the code has changed since the recorded handoff.

The next agent gets a structured brief instead of having to reconstruct the entire previous session manually.

What I Learned While Building PCSKit#

Building PCSKit changed how I think about AI-assisted software development.

Initially, the problem looked like context management. It seemed that developers simply needed a better way to save and restore information between sessions.

But the deeper I explored the problem, the more I realized that preserving information isn't enough.

The information also needs provenance.

A task marked complete isn't necessarily verified. A passing test isn't necessarily relevant to the current code. A handoff isn't necessarily trustworthy just because it exists.

These distinctions influenced the architecture of PCSKit.

I also learned that continuity should not depend on a specific AI provider. A project should be able to move between different coding agents without losing its development history.

That's why PCSKit keeps its core project state local and provides an MCP interface for compatible clients.

Who Is PCSKit For?#

PCSKit is designed for developers who:

  • Work with AI coding agents regularly.
  • Frequently reach context limits.
  • Switch between different AI coding tools.
  • Work on projects across multiple sessions.
  • Want a record of what was actually verified.
  • Need to recover project context after interrupted sessions.

It is particularly useful when development work spans multiple sessions and agents rather than a single short conversation.

What's Next for PCSKit?#

PCSKit is an evolving open-source project.

My focus is on making project continuity more reliable, improving the development workflow, and keeping the architecture practical for individual developers.

I don't see continuity as simply saving more context.

The goal is to preserve the right information, maintain its provenance, and make it useful when another agent needs to continue the work.

Try PCSKit#

PCSKit is open source and available under the Apache-2.0 license.

You can explore the documentation, installation instructions, and project details here:

Website: https://pcskit.causly.in/

GitHub: https://github.com/KNIHAL/pcskit

npm: https://www.npmjs.com/package/@knihal/pcskit

If you work with AI coding agents and have experienced context loss between sessions, I'd love for you to try it and share your feedback.

Frequently Asked Questions#

What is PCSKit?#

PCSKit (Project Continuity Kit) is a local-first CLI and MCP server that helps AI coding agents preserve and resume software development work across sessions. It uses Git state and recorded evidence to generate and verify project handoffs.

Why do AI coding agents lose context?#

AI coding agents work within sessions and context windows. When a session ends, reaches its token limit, or is replaced by another agent, the new session may not have access to the previous conversation's working context and decisions.

How does PCSKit preserve context between AI coding sessions?#

PCSKit records sessions, Git snapshots, tasks, notes, and test runs. It uses this information to generate a structured handoff that another agent can inspect and verify before continuing development.

Is PCSKit an MCP server?#

Yes. PCSKit provides both a command-line interface and an MCP server, allowing compatible AI coding clients to interact with project continuity tools.

Does PCSKit require a cloud account?#

No. PCSKit is local-first. Project continuity data is stored locally inside the project's .pcs/ directory. It does not require a cloud account or send telemetry.

How is PCSKit different from a simple HANDOFF.md generator?#

A basic handoff generator primarily creates a written summary. PCSKit builds its handoff from recorded project evidence, separates verified facts from reported claims and inferred conclusions, and checks whether the recorded state still matches the current repository.

Which AI coding agents does PCSKit support?#

PCSKit documents integration paths for Claude Code, Claude Desktop, Cursor, and other MCP-compatible clients.

Is PCSKit open source?#

Yes. PCSKit is available under the Apache-2.0 license on GitHub.


The code can survive a session. The development context should too.

Share
Kumar Nihal

Written by

Kumar Nihal

AI-first software engineer and founder of Causly. I build software, SaaS and AI systems, and write about it here. More about me

Get new posts by email

High-signal notes on AI, automation and building systems. No spam.

Keep reading

Insight

AI Coding Agent Handoffs: Why HANDOFF.md Needs Verifiable Evidence

Learn how to preserve context across AI coding agent sessions with reliable handoffs. Explore the limitations of traditional HANDOFF.md files, why task summaries aren't enough, and how Git state, test results, file changes, and verifiable evidence help agents resume development work with greater confidence.

Nov 24, 2026
Insight

MCP Tool Annotations Explained: Practical Examples, Defaults, and Security Best Practices

Understand MCP Tool Annotations and how they influence AI agent interactions with tools. Learn the four core annotations — readOnlyHint, destructiveHint, idempotentHint, and openWorldHint — with practical JSON examples, default behaviors, security considerations, common mistakes, and testing strategies for building reliable Model Context Protocol servers.

Nov 24, 2026