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

@barissozen/csns

v0.11.4

Published

CSNS — Code-aware Self-correcting Never-forgetting System

Readme

CSNS

Code-aware Self-correcting Never-forgetting System

Just say what you want. It handles the rest. Or point it at existing code — it reverse-engineers, audits, and scores your architecture.

Multi-model · Multi-language · Memory-first · Self-correcting · Codebase auditor

npm install -g @barissozen/csns
csns

What It Does

csns> /new "URL shortener with auth"     → builds it from scratch
csns> /audit                              → reverse-engineers & scores existing code
csns> /trace                              → 4-layer deep analysis
csns> /health                             → checks LLM + agent + memory status

Two modes:

  1. Build — describe what you want, CSNS makes technical decisions, writes code, tests it, audits the result
  2. Audit — point it at any TypeScript project, it classifies layers, traces data flows, checks architectural decisions, scores health 0–100

Demo: Build

$ csns

  ╔══════════════════════════════════════════════╗
  ║   CSNS v0.7.5                                ║
  ║   Code-aware Self-correcting                 ║
  ║   Never-forgetting System                    ║
  ╚══════════════════════════════════════════════╝

  Type /help for commands, /quit to exit.

  csns> /new
  📋 What do you want to build?
  > URL shortener with user registration

  🔍 Analyzing...
  ✅ JWT Auth · ✅ SQLite · ✅ REST API · ✅ TypeScript

  🚀 Starting orchestration...
  📦 M01: Foundation → ✅ (tsc ✅, test ✅)
  📦 M02: Auth       → ✅ (tsc ✅, test ✅, endpoint ✅)
  📦 M03: Shortener  → ✅ (tsc ✅, test ✅, endpoint ✅)

  🔍 Post-build audit...
  💯 Health: 94/100 — 2 minor violations, auto-fixing...
  ✅ Re-audit: 100/100

  csns> /quit
  👋 Bye.

Demo: Audit

  csns> /audit
  🔍 Running reverse engineering audit...

  ═══════════════════════════════════════════
  📋 AUDIT REPORT
  ═══════════════════════════════════════════

  🏗️  Layer Distribution:
     controller    42    service    37    middleware    17
     repository    239   config     16    schema       10

  🔀 Data Flows: 5/68 complete

  ⚠️  Violations: 43 (43 acknowledged, 0 real)
     ✅ 19x GraphQL resolver-first pattern
     ✅ 30x Inline resolver logic — accepted convention

  🧩 Patterns:
     GraphQL Federation · GraphQL Resolvers · Event-Driven
     Circuit Breaker · Service Layer · Middleware Chain

  💯 Health Score: 96/100
  ═══════════════════════════════════════════

Install

npm install -g @barissozen/csns
csns

Requirements: Node.js 20+, at least one LLM provider

# Pick one:
export ANTHROPIC_API_KEY=sk-ant-...       # Claude
export OPENAI_API_KEY=sk-...              # GPT-4o / o-series
export OLLAMA_HOST=http://localhost:11434  # Local (Llama, Mistral, etc.)

Multi-Model Support

| Provider | Env Variable | Models | |----------|-------------|--------| | Anthropic (default) | ANTHROPIC_API_KEY | Claude Sonnet, Opus, Haiku | | OpenAI | OPENAI_API_KEY | GPT-4o, o1, o3 | | Ollama | OLLAMA_HOST | Llama 3, Mistral, CodeLlama, any local model | | OpenAI-compatible | OPENAI_API_KEY + LLM_BASE_URL | Groq, Together, Azure, etc. |

# Auto-detect from env
csns

# Explicit override
LLM_PROVIDER=openai OPENAI_API_KEY=sk-... csns

# Local — no API key needed
LLM_PROVIDER=ollama csns

CLI Commands

Interactive (REPL)

csns                           → starts interactive prompt
csns> /new [brief]             → build a new project
csns> /audit                   → reverse-engineer & audit codebase
csns> /trace                   → full 4-layer analysis
csns> /status                  → show STATE.md
csns> /log                     → show DECISIONS.md
csns> /health                  → check LLM + agent CLI + memory files
csns> /help                    → list commands
csns> /quit                    → exit

Non-interactive (CI / scripts)

csns new "Build a todo API with auth"
csns audit
csns trace
csns status
csns health

Audit Engine

The /audit command reverse-engineers any TypeScript project:

4 Layers

| Layer | What | How | |-------|------|-----| | Static | Import/export graph, dead exports, circular deps, phantom deps | Regex scan of all .ts files | | Semantic | "This service should be injected but isn't" | LLM reasoning over graph + file summaries | | Runtime | Server started, HTTP probed, handler chain traced | Express middleware + HTTP probing | | Audit | Architecture recovery, decision archaeology, pattern detection | Layer classification + cross-reference |

What It Finds

| Finding | Example | |---------|---------| | Layer skip | Controller → Repository (skipping service layer) | | Wrong direction | Service imports controller (upward dependency) | | Dead export | unusedHelper() exported but never imported | | Circular dep | logger → config → logger | | Phantom dep | winston imported but not in package.json | | Decision contradiction | ARCHITECTURE says JWT but code uses session | | Pattern inconsistency | 7 routes use service layer, 52 don't |

Smart Acknowledgement

CSNS distinguishes design decisions from real bugs:

Violation found
    │
    ├── GraphQL resolver → DB direct?  → ✅ Acknowledged (resolver-first pattern)
    ├── Written in ARCHITECTURE.md?    → ✅ Acknowledged (explicit decision)
    ├── >80% routes follow same way?   → ✅ Acknowledged (project convention)
    │
    └── None of the above?             → ⚠️ Real issue — counts against health

Tested On Real Projects

Project               Files  Violations           Health
──────────────────────────────────────────────────────────
Cayman Data              37    0 (0 ack, 0 real)  100.0 💯
Yieldex                  84    1 (0 ack, 1 real)   98.3
Wallet SDK               26    1 (0 ack, 1 real)   97.8
Cayman-Hashlock         530   43 (43 ack, 0 real)  96.0
CSNS (self)              72    6 (2 ack, 4 real)   93.0
Cayman Mobile            32    5 (0 ack, 5 real)   89.4

Programmatic

import { ReverseEngineer } from '@barissozen/csns/agent';

const auditor = new ReverseEngineer('/path/to/project');
const report = await auditor.audit();

report.classifications   // file → layer mapping
report.dataFlows         // end-to-end request chains
report.violations        // architectural issues (acknowledged vs real)
report.decisionAudit     // DECISIONS.md cross-check
report.patterns          // detected design patterns
report.summary.healthScore  // 0–100

Build Engine

The 4-File Memory System

| File | What | Who | |------|------|-----| | MISSION.md | What to build, what NOT to build, success criteria | You (immutable) | | ARCHITECTURE.md | Technical decisions — auth, DB, API style | System (auto) | | DECISIONS.md | Every decision + rationale (append-only) | Log | | STATE.md | Current phase, what's done, what's left | Live |

Build → Audit → Fix Loop

/new "Build a todo API"
    │
    ▼
SmartBrief → Scaffold → Orchestrator → Agents write code
    │                                        │
    │                                   tsc ✅ test ✅
    │                                        │
    ▼                                        ▼
MISSION.md                             Audit Gate (automatic)
ARCHITECTURE.md                        Health < 70? → Fix tasks
DECISIONS.md                           Re-audit → ✅ Done
STATE.md

What It Asks vs. What It Decides

| Asks you ✅ | Decides itself ❌ | |---|---| | "Are links public or private?" | JWT or session? | | "Can users see each other's data?" | Which database? | | "Will there be payments?" | REST or GraphQL? |


Configuration

Environment Variables

| Variable | Description | Default | |----------|------------|---------| | ANTHROPIC_API_KEY | Anthropic API key | — | | OPENAI_API_KEY | OpenAI API key | — | | OLLAMA_HOST | Ollama server URL | http://localhost:11434 | | LLM_PROVIDER | Force: anthropic / openai / ollama | auto-detect | | LLM_MODEL | Model name | provider default | | LLM_BASE_URL | Custom API base URL | — | | AGENT_BINARY | Coding agent CLI binary | claude | | CSNS_LOCALE | Language: en / tr | en |

Programmatic

import { Orchestrator } from '@barissozen/csns/orchestrator';
import { createProvider } from '@barissozen/csns/llm';
import { TracerAgent } from '@barissozen/csns/agent';

// Build
const orchestrator = new Orchestrator({
  projectRoot: process.cwd(),
  llmProvider: 'openai',
  llmApiKey: 'sk-...',
  locale: 'en',
  maxRetries: 3,
  verbose: true,
});
await orchestrator.run('Build a REST API for todos');

// Audit
const tracer = new TracerAgent({
  projectRoot: '/path/to/project',
  llmProvider: createProvider(),
});
const report = await tracer.run();

Project Structure

src/
├── bin/             CLI — csns (interactive REPL + non-interactive)
├── brief/           SmartBrief + BriefCollector
├── agent/           Agent Runner, Context Builder, Codebase Reader
│   └── tracer/      Static Analyzer, Semantic Analyzer, Runtime Tracer,
│                    Reverse Engineer (audit engine)
├── orchestrator/    Planner, Evaluator, Escalator, Scaffold, Audit Gate
├── memory/          4-file read/write layer
├── llm/             Provider abstraction (Anthropic, OpenAI, Ollama)
├── i18n/            Internationalization (en, tr)
└── types/           TypeScript interfaces

Tests

npm test                          # 229 tests, 19 suites
SKIP_E2E=1 npm test               # skip real CLI tests

Design Principles

  1. Memory-First — Every decision leaves a trace in files
  2. Fail-Safe — When in doubt, ask the human
  3. Append-Only — DECISIONS.md is never edited
  4. Provider-Agnostic — Any LLM, any agent CLI
  5. Acknowledged vs Real — Design decisions ≠ bugs

Contributing

  1. Fork → branch → test → PR
  2. npm test must pass
  3. npx tsc --noEmit — 0 errors
  4. Conventional commits (feat:, fix:, docs:)

License

MIT — Baris Sozen