A modular system prompt composition framework for AI assistants
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
Prompt Composer
A modular system prompt composition framework that intelligently generates system prompts for AI assistants based on available tools, task complexity, and contextual information.
Language Support
- Python:
pip install system-prompt-composer - Node.js:
npm install system-prompt-composer(native bindings - no Python required!)
Quick Start
Python
import system_prompt_composer
import json
request = {
"user_prompt": "Help me analyze this code",
"mcp_config": {"mcpServers": {...}},
"session_state": {"tool_call_count": 0}
}
response = system_prompt_composer.compose_system_prompt(json.dumps(request))
result = json.loads(response)
print(result["system_prompt"])
Node.js (Native)
const { composeSystemPrompt } = require('system-prompt-composer');
const request = {
user_prompt: "Help me analyze this code",
mcp_config: { mcpServers: {...} },
session_state: { tool_call_count: 0 }
};
const response = await composeSystemPrompt(request);
console.log(response.system_prompt);
๐ For detailed Node.js documentation, see node/README.md
Project Structure
prompt-composer/
โโโ core/ # Rust core implementation
โ โโโ lib.rs # Main library with NAPI bindings
โ โโโ types.rs # Type definitions
โ โโโ composition.rs # Prompt composition logic
โ โโโ ...
โโโ python/ # Python package (PyO3 bindings)
โโโ node/ # Node.js package (native NAPI-RS bindings)
โ โโโ package.json
โ โโโ index.js # Native bindings wrapper
โ โโโ index.d.ts # TypeScript definitions
โโโ prompts/ # Modular prompt library
โ โโโ domains/ # Domain-specific prompts
โ โโโ behaviors/ # Behavioral guidance prompts
โโโ README.md # This file
Features
- ๐ง Intelligent prompts that adapt to available MCP tools
- ๐ Automatic task planning for complex requests
- ๐ฏ Context-aware guidance for different domains (programming, analysis, filesystem, etc.)
- ๐ Progress monitoring for multi-step workflows
- ๐ Modular design with composable prompt components
- โก High performance with Rust core
- ๐ Multi-language support (Python, Node.js)
Installation
Python Package
pip install system-prompt-composer
Node.js Package (Native - No Python Required!)
npm install system-prompt-composer
The Node.js package now uses native Rust bindings via NAPI-RS, eliminating the Python dependency!
API Reference
Core Functions
composeSystemPrompt(request)
Generate an intelligent system prompt based on available tools and context.
Parameters:
request.user_prompt(string): The user's requestrequest.mcp_config(object): MCP server configuration withmcpServersrequest.session_state(object): Current session state includingtool_call_countrequest.domain_hints(array, optional): Domain hints like["programming", "analysis"]request.task_complexity(string, optional):"Simple","Complex", or"Auto"
Returns:
{
system_prompt: "Generated prompt text...",
source: "native",
version: "1.1.0",
// ... additional metadata
}
listAvailableDomains()
Returns array of available domain modules: ["programming", "analysis", "filesystem", "system"]
listAvailableBehaviors()
Returns array of available behavior modules: ["planning", "progress", "reasoning", "tools"]
getStatus()
Returns system status and configuration information.
isAvailable()
Always returns true for native bindings.
Architecture
Native Node.js Architecture (NEW):
Node.js โ NAPI-RS โ Rust Core
Python Architecture:
Python โ PyO3 โ Rust Core
Key Benefits of Native Bindings:
- โ No Python dependency for Node.js users
- โ Native performance - direct Rust execution
- โ
Simple deployment - just
npm install - โ Better error handling
- โ Cross-platform binary distribution
- โ Smaller bundle size
Development
Building Native Node.js Package
cd node/
npm install
npm run build # Build release binaries
npm run build:debug # Build debug binaries
npm test # Run tests
Python Development
cd python/
pip install -e .
Rust Core Development
cargo build --release
cargo test
cargo build --features nodejs # For Node.js bindings
cargo build --features python # For Python bindings
Publishing
Node.js (npm)
cd node/
npm run build # Build native binaries
npm publish --access public
Python (PyPI)
cd python/
pip install build twine
python -m build
twine upload dist/*
Contributing
Contributions welcome! The project uses:
- Rust for the core prompt composition engine
- NAPI-RS for Node.js native bindings
- PyO3 for Python bindings
- Modular prompts in the
prompts/directory
License
MIT License - see LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file system_prompt_composer-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: system_prompt_composer-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 546.6 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
981ae6537742d9b96cfd91d0139637144174a2e1aefdc16726685221bb0a0816
|
|
| MD5 |
7f1e16eb3e3bd6b1cc288d790961dbf4
|
|
| BLAKE2b-256 |
895b72d68e9750d2e642bd1f959fbfa284bdb5c1b6ae88eaebf4f8a82190c24d
|