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

qtools-ai-two-step-sample

v1.0.1

Published

A simple two-step AI processing example using qtools-ai-framework

Readme

qtoolsAiTwoStepSample

A simple example application demonstrating the qtools-ai-framework with a two-step AI processing pipeline.

Overview

This application demonstrates how to create a minimal AI processing application using the qtools-ai-framework. It processes user input through two sequential steps:

  1. Create Something - Takes a user prompt and generates initial content
  2. Revise That Thing - Takes the generated content and modifies it based on a revision prompt

Installation

npm install

Usage

node qtoolsAiTwoStepSample.js --creatingPrompt="tell me a one sentence story" --revisingPrompt="Make it talk like a pirate"

Parameters

  • --creatingPrompt (required) - The initial prompt for content creation
  • --revisingPrompt (required) - The prompt for revising the created content
  • --debug (optional) - Enable debug logging to see intermediate steps

Examples

Basic usage:

node qtoolsAiTwoStepSample.js --creatingPrompt="write a haiku about coffee" --revisingPrompt="make it rhyme better"

With debug output:

node qtoolsAiTwoStepSample.js --creatingPrompt="describe a sunset" --revisingPrompt="make it more poetic" --debug

Sample Output:

Once upon a fine time, th' scurvyre be a fine brave knight who saved th' scurvy kingdom, arrr! Yo ho ho!

Environment Variables

Note: The current implementation uses simple text transformations instead of actual AI calls. To use real AI, you would need to:

  1. Set your OpenAI API key:
export OPENAI_API_KEY=your_api_key_here
  1. Update the thinkers to use the provided promptGenerator and accessSmartyPants functions instead of the simplified text transformations.

Architecture

The application follows the qtools-ai-framework pattern with wisdom-bus architecture:

  • Main Application (qtoolsAiTwoStepSample.js) - Entry point and CLI handling
  • Configuration (qtoolsAiTwoStepSample.ini) - Thought process and thinker definitions
  • Thinkers (lib/thinkers/) - Processing modules using wisdom-bus for data flow
  • Prompt Library (lib/prompt-library/) - AI prompt templates
  • Wisdom-Bus - Thread-safe data management system for sharing data between thinkers

Project Structure

qtoolsAiTwoStepSample/
├── qtoolsAiTwoStepSample.js      # Main application
├── qtoolsAiTwoStepSample.ini     # Configuration
├── package.json                   # Dependencies
├── README.md                      # This file
└── lib/
    ├── thinkers/
    │   ├── create-something/
    │   │   └── create-something.js
    │   └── revise-that-thing/
    │       └── revise-that-thing.js
    └── prompt-library/
        ├── onlyPrompts.js
        └── prompts.d/
            └── onlyPrompts/
                ├── create-something.js
                └── revise-that-thing.js

How It Works

  1. User provides creating and revising prompts via command line
  2. Framework initializes with configuration from .ini file and creates wisdom-bus
  3. Initial prompts are stored in wisdom-bus as initialThinkerData
  4. create-something thinker:
    • Reads creatingPrompt from wisdom-bus using wisdomBus.getAll()
    • Generates content using AI
    • Stores result as lastAiResponse using wisdomBus.add()
  5. revise-that-thing thinker:
    • Reads both lastAiResponse and revisingPrompt from wisdom-bus
    • Processes revision using AI
    • Updates lastAiResponse with revised content
  6. Final consolidated wisdom is output to stdout via xLog.result()

Wisdom-Bus Data Flow

The wisdom-bus ensures thread-safe data sharing between thinkers:

// Thinker reads data
const currentWisdom = wisdomBus.getAll();
const inputData = currentWisdom.someKey;

// Thinker processes and adds results  
const result = processData(inputData);
wisdomBus.add('outputKey', result);

Each thinker gets its own namespaced accessor, preventing data collisions while allowing access to shared data from previous thinkers.

This serves as a template for building more complex AI processing applications with the qtools-ai-framework wisdom-bus architecture.