@yashu_jaat01/ai-persona
v0.3.0
Published
A fluent AI SDK and CLI for terminal chat, session memory, personalities, and local RAG support
Maintainers
Readme
@yashu_jaat01/ai-persona
A fluent AI SDK and CLI for terminal chat, session memory, personalities, local RAG, streaming answers, and document-aware workflows.
Features
- Interactive setup wizard
- Terminal chat mode
- Streaming AI responses in the terminal
- Colored output and spinner-based CLI UX
- Named chat sessions with local memory
- Memory commands: list, show, recent, summary, clear, delete
- SDK-based AI usage in projects
- Local RAG for
.txt,.md,.pdf, and.docxfiles - Multi-provider support
- Use-case based feature locking
- Update notifications for newer versions
Installation
npm install @yashu_jaat01/ai-personaFor global CLI usage:
npm install -g @yashu_jaat01/ai-personaSetup
Run the interactive setup wizard:
npx ai-persona initThe wizard asks for:
- Use case
- Provider
- API key
- AI personality
It creates:
.ai-persona/config.json.env
Use Case Modes
Your selected use case unlocks only the features relevant to that mode.
cli
Unlocked:
npx ai-persona chat- Session-based local memory commands
Locked:
- SDK usage
- RAG indexing
- RAG retrieval
sdk
Unlocked:
import { ai } from '@yashu_jaat01/ai-persona'ai.chat(...)
Locked:
- CLI chat
- RAG indexing
- RAG retrieval
rag
Unlocked:
npx ai-persona rag init ./docs- RAG-based SDK answers after indexing
Locked:
- CLI chat
- Non-RAG SDK mode
both
Unlocked:
- CLI chat
- SDK usage
- RAG indexing
- RAG retrieval
To change your mode later, re-run:
npx ai-persona initCLI Usage
CLI chat is available in cli or both mode.
Start chat
npx ai-persona chatStart chat with a named session
npx ai-persona chat project-alphaType exit to quit.
Memory Commands
Session memory commands are available for saved local chat sessions.
List sessions
npx ai-persona memory listShow full session history
npx ai-persona memory show project-alphaShow recent messages
npx ai-persona memory recent project-alpha 5Show session summary
npx ai-persona memory summary project-alphaClear one session
npx ai-persona memory clear project-alphaClear all sessions
npx ai-persona memory clear allDelete one session
npx ai-persona memory delete project-alphaSDK Usage
SDK usage is available in sdk, rag, or both mode.
Basic chat
import { ai } from '@yashu_jaat01/ai-persona';
const reply = await ai
.personality('Senior developer')
.chat('Explain closures in simple words');
console.log(reply);SDK chat with session memory
import { ai } from '@yashu_jaat01/ai-persona';
const reply = await ai.chat('Remember that my favorite language is JavaScript.', {
sessionId: 'project-alpha'
});
console.log(reply);Streaming Chat
Terminal chat now supports streaming responses for a smoother experience, along with colored output and a spinner while the model starts responding.
npx ai-persona chatThis is built into the CLI automatically, so no extra flags are required.
RAG Usage
RAG is available in rag or both mode.
RAG answers only work after you index your files first.
Step 1: Index your files
npx ai-persona rag init ./docsSupported file types:
.txt.md.pdf.docx
This creates:
.ai-persona/rag-store.jsonStep 2: Ask RAG-based questions
import { ai } from '@yashu_jaat01/ai-persona';
const reply = await ai.chat('What does the documentation say about authentication?');
console.log(reply);If a RAG index exists, the package retrieves relevant document chunks and uses them as context.
Chatbot Integration
In both mode, you can use the package to build chatbots in your own apps.
import { ai } from '@yashu_jaat01/ai-persona';
const reply = await ai.chat('Hello, how can you help me?');
console.log(reply);If RAG is enabled and files are indexed first, chatbot responses can also be grounded in your local documents.
Provider Support
Chat providers
- OpenAI
- Anthropic
Embedding providers for RAG
- OpenAI
Anthropic is not currently supported for embeddings in the RAG pipeline.
Version Updates
The CLI can notify users when a newer package version is available, so older installations can upgrade more easily.
Troubleshooting
Feature is locked
If you see a locked-feature error, your current use case does not allow that feature.
Re-run:
npx ai-persona initand choose a different mode.
Memory is not showing expected results
Make sure:
- You are using the same session name
- You exited chat normally after sending messages
- You are checking the correct session with
memory showormemory summary
RAG is not working
Make sure:
- You selected
ragorboth - You indexed files first
.ai-persona/rag-store.jsonexists- Your files are in a supported format:
.txt,.md,.pdf, or.docx
PDF parsing issues in ESM
If you are developing locally and hit ESM import issues with pdf-parse, make sure your installed package version matches your import style and rebuild before testing.
Publish errors
If you publish under your personal npm account, use your npm username as the package scope. Scoped public packages need to be published with the correct scope and package access settings [web:847].
Local Development
npm install
npm run build
node dist/cli.js init
node dist/cli.js chat
node dist/cli.js chat project-alpha
node dist/cli.js memory list
node dist/cli.js rag init ./docsLicense
ISC
