Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ghostpaw/souls

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ghostpaw/souls

Prompt evolution engine — evidence-backed cognitive identity for AI agents with traits, crystallization-gated refinement, level-up consolidation, and full rollback. Node 24+, built-in node:sqlite, zero runtime dependencies.

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

@ghostpaw/souls

Prompt evolution engine for cognitive identity. Stores identity as narrative essence plus evidence-backed traits, with structured level-up, crystallization-gated refinement, and full rollback. Not a prompt template library. Not a configuration manager. An evolutionary algorithm for how agents think.

Node 24+, built-in node:sqlite, zero runtime dependencies.

Install

npm install @ghostpaw/souls

Quick Start

import { DatabaseSync } from 'node:sqlite';
import { initSoulsTables, read, write } from '@ghostpaw/souls';

const db = new DatabaseSync(':memory:');
initSoulsTables(db);

const soul = write.createSoul(db, {
  name: 'Reviewer',
  essence: 'I review code by reading for intent before scanning for bugs.',
  description: 'Code review specialist',
});

write.addTrait(db, soul.id, {
  principle: 'Read the PR description before the diff.',
  provenance: 'Reviews that started with code missed architectural intent 3 of 4 times.',
});

write.dropShard(db, {
  content: 'Reviewer caught a naming inconsistency by reading the RFC first.',
  source: 'session',
  soulIds: [soul.id],
});

const rendered = read.renderSoul(db, soul.id);

What It Does

A soul is one cognitive identity — not a prompt template, not a config object. How an agent thinks, judges, and approaches problems.

A trait is a cognitive principle with provenance — evidence proving it was earned, not invented.

A shard is a behavioral observation from any source, attributed to souls. Shards accumulate silently. When enough evidence converges across independent channels over time, the soul becomes eligible for refinement.

Level-up consolidates: merge overlapping traits, promote absorbed ones into the essence, carry forward those still teaching. The identity restructures and the generation counter increments.

The rendered identity block (essence + active traits) is static between mutations — no drift, no context accumulation, no re-rendering overhead. It does not drift because there is nothing to drift.

API Surface

import { read, write, ether, soul, tools, skills } from '@ghostpaw/souls';
NamespacePurpose
readQueries — get souls, traits, shards, evidence reports, render identity blocks
writeMutations — create souls, add/revise/revert traits, drop shards, level up
etherSoul template discovery — search ~2,800 open-source prompts, manifest as souls
soulThe built-in Mentor soul — gardener identity for guiding refinement
toolsLLM tool facade — JSON Schema definitions for agent framework integration
skillsMarkdown procedures — crystallization, refinement, level-up, maintenance workflows

Core Lifecycle

observe → crystallize → refine → level up → repeat

Shards accumulate from any source. Crystallization gates refinement until evidence converges across 2+ independent channels over 1+ days. Traits mutate with provenance. Level-up restructures when the identity outgrows its current form.

The Mentor

The package ships one built-in soul — the Mentor — tuned for guiding the entire refinement lifecycle:

import { soul } from '@ghostpaw/souls';

const systemPrompt = soul.renderSoulsSoulPromptFoundation();

Ether — Template Discovery

Browse and search a catalog of open-source system prompts, then manifest them as fully-formed souls:

import { ether } from '@ghostpaw/souls';

const etherDb = ether.open('ether.db');
ether.registerDefaults(etherDb);
await ether.refreshAll(etherDb);

const results = ether.search(etherDb, 'security architect');
const newSoul = ether.manifest(soulsDb, results[0]);

Sources are fetched lazily with ETag caching. Refresh is atomic — failed fetches never erase existing data.

LLM Tools

Wire into any agent framework via JSON Schema tool definitions:

import { tools } from '@ghostpaw/souls';

const allTools = tools.allToolDefinitions();
const result = tools.executeTool(db, toolName, args);

Ecosystem

Souls is one of four faculties in the GhostPaw cognitive substrate:

FacultyDomainCore Loop
questlogtasks and commitmentsplan, track, complete, reward
affinitypeople and relationshipsmeet, bond, interact, maintain
codexbeliefs and knowledgeremember, recall, revise, flag
soulscognitive identityobserve, crystallize, refine, level up

Each faculty owns one slice of state. Each stays lean at the storage layer with the same architecture: Node 24+, built-in node:sqlite, zero runtime dependencies.

Souls is unique in the quartet: it is the only faculty whose output becomes the system prompt. Questlog produces task state. Affinity produces relationship state. Codex produces belief state. Souls produces the identity block that shapes how all other state is interpreted.

Together they form a complete cognitive substrate for agents that grow.

Domain Mapping

The engine provides a single abstraction — identity that evolves from evidence — that maps to any domain where behavior should improve from observation:

DomainSoul isTraits are
LLM agentsagent identitybehavioral principles
Game NPCsNPC personalitycharacter qualities
AI companionscompanion identitypersonality facets
Creative writingfictional charactercharacter traits
Brand voicebrand identityvoice guidelines
Educational tutorteaching stylepedagogical principles
Code reviewreviewer styleteam preferences

Demo

An interactive local-first demo app with RPG character sheet aesthetics:

npm run demo:ether   # fetch template catalog
npm run demo:serve   # build and serve at localhost:7777

Docs

DocumentAudience
CONCEPT.mdFull design rationale, research citations, invariants
docs/LLM.mdLLM harness builders — tool surface, rendering, soul layer
docs/HUMAN.mdHuman developers — direct read/write/ether API
docs/PAGES.mdDemo app pages, architecture, development
docs/entities/Entity deep-dives: souls, traits, shards, levels, ether

License

MIT

Keywords

prompt-evolution

FAQs

Package last updated on 06 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts