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

@little-samo/samo-ai-repository-storage

v0.6.1

Published

File system-based repository implementations for SamoAI

Downloads

19

Readme

Features

  • File system-based storage for SamoAI entities
  • Persistent memory and state management
  • Support for agents, users, locations, items, and gimmicks
  • TypeScript support with full type safety

Installation

Install the package using npm:

npm install @little-samo/samo-ai-repository-storage

Or using yarn:

yarn add @little-samo/samo-ai-repository-storage

Usage

Basic Setup

import {
  AgentStorage,
  UserStorage,
  LocationStorage,
  ItemStorage,
  GimmickStorage
} from '@little-samo/samo-ai-repository-storage';
import { WorldManager } from '@little-samo/samo-ai';

// Initialize storage instances
const agentStorage = new AgentStorage(
  './models/agents',    // Path to agent model files
  './states/agents'     // Path to agent state files
);

const userStorage = new UserStorage(
  './models/users',
  './states/users'
);

const locationStorage = new LocationStorage(
  './models/locations',
  './states/locations'
);

const itemStorage = new ItemStorage(
  './states/items'      // Only state path needed for items
);

const gimmickStorage = new GimmickStorage(
  './states/gimmicks'   // Only state path needed for gimmicks
);

// Initialize with existing data
await agentStorage.initialize(['samo', 'nyx']); // Load samo.json and nyx.json
await userStorage.initialize(['lucid']); // Load lucid.json
await locationStorage.initialize(['empty']);
await itemStorage.initialize(['agent:1', 'user:1']); // Initialize inventories
await gimmickStorage.initialize([1]); // Initialize gimmicks for location

// Initialize WorldManager with all repositories
WorldManager.initialize({
  agentRepository: agentStorage,
  gimmickRepository: gimmickStorage,
  itemRepository: itemStorage,
  locationRepository: locationStorage,
  userRepository: userStorage,
});

Environment Configuration

To use LLM features, you need to configure API keys for the supported platforms. Set the following environment variables:

  • OpenAI: OPENAI_API_KEY=your_openai_api_key
  • Gemini: GEMINI_API_KEY=your_gemini_api_key
  • Anthropic: ANTHROPIC_API_KEY=your_anthropic_api_key

You can set these in several ways:

  • Set environment variables directly: OPENAI_API_KEY=sk-... node your-app.js
  • Use dotenv package with a .env file:
    OPENAI_API_KEY=sk-...
    GEMINI_API_KEY=AI...
    ANTHROPIC_API_KEY=sk-ant-...
  • Set them in your system environment

Note: Currently, API keys are shared across all users. In a production environment, you would typically store user-specific API keys.

File Structure

The storage system expects the following directory structure:

your-project/
├── models/
│   ├── agents/
│   │   ├── samo.json
│   │   └── nyx.json
│   ├── users/
│   │   └── lucid.json
│   └── locations/
│       └── empty.json
└── states/
    ├── agents/
    │   ├── samo.json
    │   └── nyx.json
    ├── users/
    │   └── lucid.json
    ├── locations/
    │   └── empty.json
    ├── items/
    │   ├── items_agent_1.json
    │   └── items_user_1.json
    └── gimmicks/
        └── gimmicks_1.json
  • models/: Static entity definitions (agents, users, locations only) - Must be created manually
  • states/: Dynamic runtime data that changes during execution - Created automatically if missing
  • items/: Inventory data per entity (format: items_{entityType}_{entityId}.json)
  • gimmicks/: Gimmick states per location (format: gimmicks_{locationId}.json)

Note: Items and gimmicks don't have model files - they are created and managed entirely through the state files. The states/ directories will be automatically created during initialization if they don't exist.

Learn More

License

MIT License