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

@moolam/cognitive-core

v1.1.0

Published

Internal component of Sutra SDK — applications should install sutra-sdk. The cognitive core. Domain-agnostic composition of the cognitive primitives (memory, model, reasoning, speech, vision, tools, planning, knowledge) into one perceive-recall-reason-act

Readme

@moolam/cognitive-core

The cognitive composition loop. CognitiveCore takes an AgentProfile (charter, refusals, languages) and one binding per contract, and runs the turn:

perceive (Speech/Vision) → recall (Memory) → retrieve (Knowledge)
→ reason (Reasoning) → plan/act (Planning + Tools) → respond (Model/Speech)
→ reflect (Memory)

Nothing in this package knows which domain it serves or which host it runs in. A teacher, a legal companion, and a clinical assistant are the same loop with different bindings and profiles.

Architecture

  • src/harness.ts: CognitiveCore, CognitiveBindings, AgentProfile, AgentTurnInput, AgentTurnOutput.
  • Depends only on @moolam/contracts. No environment assumptions (no filesystem, no timers, no network); hosts supply those through the runtime contracts.
  • Refusals from the profile enter reasoning as constraints; violations surface in unresolvedConstraints and the core declines rather than answers.

Public API

CognitiveCore (the class), the binding and profile types, and the turn input/output types. All exported from src/index.ts.

Quick start

import { CognitiveCore } from "@moolam/cognitive-core";

const core = new CognitiveCore(profile, bindings);
const out = await core.turn({
  subjectId: "subject-1",
  sessionId: crypto.randomUUID(),
  utterance: "Where should we start?",
});

Applications should normally import through sutra-sdk instead.

Contributing notes

  • Keep the loop domain-free: profession-specific vocabulary in this package is review-blocking.
  • Composition overhead budget is ≤ 10ms p95 per turn excluding bound-implementation time (PRD NFR-06); benchmarks/core_loop.bench.mjs measures it.

Examples

examples/teacher-basic/ and examples/lawyer-basic/ run this loop with different configurations; that pair is the package's thesis demonstrated.

Tests

pnpm --filter @moolam/cognitive-core test