npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

contexa

v1.1.2

Published

Git-inspired context management for LLM agents -- COMMIT, BRANCH, MERGE, and CONTEXT over versioned memory (arXiv:2508.00031)

Readme

contexa

npm version Node.js 18+ License: MIT GitHub

Git-inspired context management for LLM agents. COMMIT, BRANCH, MERGE, and CONTEXT operations over a persistent versioned memory workspace.

TypeScript/JavaScript implementation of the contexa framework.

Based on: arXiv:2508.00031 -- "Git Context Controller: Manage the Context of LLM-based Agents like Git" (Junde Wu et al., 2025)


Installation

npm install contexa

Or with yarn/pnpm:

yarn add contexa
pnpm add contexa

Quick Start

import { GCCWorkspace } from "contexa";

// 1. Initialize a workspace
const ws = new GCCWorkspace("/path/to/project");
ws.init("Build a REST API service with user auth");

// 2. Agent logs its reasoning as it works
ws.logOTA(
  "Project directory is empty",
  "Need to scaffold the project structure first",
  "create_files(['main.ts', 'package.json', 'models.ts'])"
);

// 3. Commit a milestone (compresses OTA history)
ws.commit("Project scaffold and User model complete");

// 4. Branch to explore an alternative approach
ws.branch("auth-jwt", "Explore JWT-based authentication");
ws.logOTA("Reading JWT docs", "JWT is stateless, good for APIs", "implementJWT()");
ws.commit("JWT auth middleware implemented");

// 5. Merge the successful branch back
ws.merge("auth-jwt");

// 6. Retrieve context for the agent's next step
const ctx = ws.context(undefined, 1); // K=1: paper default
console.log(ctx.summary());

Core Concepts

OTA Logging (Observation-Thought-Action)

Every reasoning step is an OTA cycle, logged continuously in log.md:

const rec = ws.logOTA(
  "API returns 500 error on /users endpoint",
  "The database connection might not be initialized",
  "checkDbConnection()"
);
console.log(rec.step);      // 1 (auto-incremented)
console.log(rec.timestamp); // 2025-03-04T12:00:00.000Z

COMMIT -- Save Milestones

const commit = ws.commit(
  "Fixed database connection and /users endpoint returns 200",
  undefined,                       // previous summary auto-populated
  "Database layer stable, move on" // optional roadmap update
);
console.log(commit.commitId);   // "a3f2b1c4" (8-char hex)
console.log(commit.branchName); // "main"

BRANCH -- Explore Alternatives

ws.branch("redis-cache", "Try Redis caching instead of in-memory");
ws.logOTA("Redis docs reviewed", "Need redis package", "npmInstall('redis')");
ws.commit("Redis caching layer implemented");

console.log(ws.listBranches()); // ['main', 'redis-cache']
console.log(ws.currentBranch); // 'redis-cache'

MERGE -- Integrate Results

const mergeCommit = ws.merge("redis-cache", undefined, "main");
// - Appends branch OTA trace to main's log
// - Creates a merge commit on main
// - Marks branch as "merged" in metadata
console.log(ws.currentBranch); // 'main'

CONTEXT -- Retrieve History

// K=1: only the most recent commit (paper's recommended default)
const ctx = ws.context(undefined, 1);

console.log(ctx.branchName);  // "main"
console.log(ctx.mainRoadmap); // Global project roadmap
console.log(ctx.commits);     // Last K CommitRecord objects
console.log(ctx.otaRecords);  // All OTA records on the branch
console.log(ctx.metadata);    // BranchMetadata object

// Formatted markdown summary ready for LLM prompt injection
const promptContext = ctx.summary();

API Reference

GCCWorkspace

| Method | Parameters | Returns | Description | |--------|-----------|---------|-------------| | constructor | projectRoot: string | -- | Set the project root directory | | init | projectRoadmap?: string | void | Create .GCC/ structure with main branch | | load | -- | void | Load an existing workspace | | logOTA | observation, thought, action | OTARecord | Append OTA step to current branch | | commit | contribution, previousSummary?, updateRoadmap? | CommitRecord | Create milestone checkpoint | | branch | name, purpose | void | Create and switch to new branch | | merge | branchName, summary?, target? | CommitRecord | Merge branch into target | | context | branch?, k? | ContextResult | Retrieve historical context | | switchBranch | name | void | Switch active branch | | listBranches | -- | string[] | List all branch names | | currentBranch | (getter) | string | Get current active branch name |


Type Definitions

interface OTARecord {
  step: number;
  timestamp: string;
  observation: string;
  thought: string;
  action: string;
}

interface CommitRecord {
  commitId: string;
  branchName: string;
  branchPurpose: string;
  previousProgressSummary: string;
  thisCommitContribution: string;
  timestamp: string;
}

interface BranchMetadata {
  name: string;
  purpose: string;
  createdFrom: string;
  createdAt: string;
  status: "active" | "merged" | "abandoned";
  mergedInto?: string;
  mergedAt?: string;
}

interface ContextResult {
  branchName: string;
  k: number;
  commits: CommitRecord[];
  otaRecords: OTARecord[];
  mainRoadmap: string;
  metadata?: BranchMetadata;
  summary(): string;
}

Directory Structure

your-project/
  .GCC/
    main.md                          # Global roadmap
    branches/
      main/
        log.md                       # Continuous OTA trace
        commit.md                    # Milestone-level summaries
        metadata.yaml                # Branch intent & status
      feature-branch/
        log.md
        commit.md
        metadata.yaml

All data is stored as human-readable Markdown and YAML.


Running Tests

git clone https://github.com/swadhinbiswas/Cortexa.git
cd contexa/JS
npm install
npm test

Building

npm run build
# Outputs dist/index.js (CJS), dist/index.mjs (ESM), dist/index.d.ts (types)

Requirements

  • Node.js >= 18
  • js-yaml >= 4.1.0

License

MIT License. See LICENSE for details.


Citation

@article{wu2025gcc,
  title={Git Context Controller: Manage the Context of LLM-based Agents like Git},
  author={Wu, Junde and others},
  journal={arXiv preprint arXiv:2508.00031},
  year={2025}
}

Links