Revulation is an AI-powered CLI for:
- Chat with a GLM / OpenAI-compatible model with credit tracking
- Agentic tools (web search, scraping, local file tools)
- Agentic coding (design and generate/edit code)
- Gang workflow framework (JavaScript-based team orchestration with members, squads, tests, observability)
This README explains how to install, configure, and use all modes, including the new Gang workflow framework.
- Node.js 18+ (for native ESM and the built-in
node:testframework) - A GLM-compatible API key in the environment (
GLM_API_KEY)
From the project root:
npm installCreate a .env file in the project root:
GLM_API_KEY=your_api_key_here
GLM_API_BASE=https://api.z.ai/api/paas/v4/GLM_API_BASE is optional and defaults to the GLM endpoint shown above.
The CLI entry point is bin/cli.js. After installing dependencies you can run:
npm startor directly:
node ./bin/cli.jsIf you install it globally (optional):
npm install -g .
revulationRunning without arguments shows the main interactive menu. You can also call subcommands directly:
revulation chatrevulation tools [task...]revulation agentic-chatrevulation code [spec...]revulation gang <config.js|name> [options]
There are two chat modes.
Start an interactive chat session:
revulation chatFeatures:
- Streaming responses
- Simple per-user memory in the CLI session
- Credit tracking via
CreditManager
Exit by typing exit or cancelling the prompt.
Start an interactive agentic chat session:
revulation agentic-chatThis uses the same tools agent as the tools command (web search, scraping, files, and mcp_call if configured) but in a conversational loop, so you can iteratively refine tasks.
Run the tools agent (web search, scraping, local files, optional MCP server) for a one-shot task:
revulation tools "Find the latest docs for Node.js LTS and summarize changes."If you omit the task, the CLI will prompt you.
Available tools:
web_search: DuckDuckGo Instant Answer APIscrape_url: scrape visible text from a web pagelist_directory: list files/folders in a directoryread_file: read a local text file (snippet)mcp_call: call a configured MCP JSON-RPC server method
The tools agent uses LangChain's tool-calling agent under the hood.
Let the coding agent design or generate code:
revulation code "Create a simple todo CLI in Node.js"or choose Code from the main menu.
Features:
- Reasoning panel: stream-of-consciousness design output
- File actions:
- Create new
index.jsunder a folder - Generate or overwrite a specific file
- Edit an existing file (with diff preview and confirmation)
- Experimental multi-file edit in a folder
- Create new
This mode is powered by src/agents/codingAgent.js.
The Gang framework lets you describe teams of AI members, tools, workflows, tests, and observability using JavaScript objects instead of YAML files. This provides better IDE support, type checking, and dynamic configuration capabilities.
# Run a single workflow instance using predefined gang template
revulation gang research --input "Research latest AI trends"
# Run using JavaScript configuration file
revulation gang ./my-gang-config.js --input "Analyze project requirements"
# Run all tests defined in configuration
revulation gang ./my-gang-config.js --testsIf you omit --input, CLI will prompt you for an input task.
import { createMember, createWorkflow, createSquad } from "./src/workflows/gangEngine.js";
export const gangConfig = {
name: "research-gang",
version: 1,
llm: {
model: "GLM-4.5-Flash",
temperature: 0.4
},
members: [
createMember("researcher", "Research topic using tools and summarize", [
"web_search",
"scrape_url"
], "shared"),
createMember("writer", "Design solution based on research", [], "shared")
],
workflow: createWorkflow("researcher", [
{ from: "researcher", to: "writer", when: "data_ready" }
]),
observability: {
enabled: true,
logLevel: "info",
markdownReport: { enabled: true }
}
};Built-in tools (no import needed):
web_search: Search web via DuckDuckGo Instant Answer APIscrape_url: Scrape visible text from web pageslist_directory: List files and folders in local directoriesread_file: Read contents of local text filesmcp_call: Call MCP server (ifMCP_SERVER_URLis configured)
members: [
{
name: "analyst",
role: "Data analysis specialist who examines information and extracts insights",
tools: ["web_search", "read_file"],
memoryId: "shared" // Optional: defaults to "shared"
},
{
name: "designer",
role: "Solution designer who creates structured outputs",
tools: [],
memoryId: "shared"
}
]Squads are groups of members that can work together:
squads: [
{
name: "research_squad",
mode: "parallel", // "parallel" or "sequential"
members: ["researcher", "analyst"]
},
{
name: "production_squad",
mode: "sequential",
members: ["writer", "reviewer"]
}
]Define execution flow between members and squads:
workflow: {
entry: "researcher", // Starting member/squad
steps: [
{ from: "researcher", to: "analyst", when: "data_found" },
{ from: "analyst", to: "writer", when: "analysis_complete" },
{ from: "researcher", to: "writer", when: "no_data_needed" },
{ from: "writer", to: "reviewer", when: "always" }
]
}Define tests for your gang workflows:
tests: [
{
name: "research-completes",
input: "Find information about quantum computing",
asserts: [
{
type: "contains",
target: "researcher",
value: "quantum"
},
{
type: "contains",
target: "writer",
value: "summary"
}
]
},
{
name: "error-handling",
input: "invalid input that should trigger error",
asserts: [
{
type: "contains",
target: "researcher",
value: "error"
}
]
}
]The CLI includes several predefined gang templates:
revulation gang research --input "Your research topic"- Members: researcher (with web search/scraping), writer (synthesis)
- Use case: Research tasks and content creation
revulation gang analysis --input "Your analysis request"- Members: analyst (with file tools), reporter (output generation)
- Use case: Data analysis and reporting
import { GangEngine, createGang } from "./src/workflows/gangEngine.js";
// Using factory function
const gang = createGang(gangConfig);
const result = await gang.runOnce("Analyze market trends");
// Direct instantiation
const engine = new GangEngine({ config: gangConfig });
const results = await engine.runTests();Gang workflows generate reports in gang_reports/ directory:
- JSON reports: Machine-readable test results with detailed metrics
- Markdown reports: Human-readable summaries and analysis
observability: {
enabled: true,
logLevel: "info",
markdownReport: {
enabled: true,
file: "./custom-report.md" // Optional custom file
}
}// Modify gang at runtime
engine.addMember(createMember("reviewer", "Final review specialist"));
engine.updateWorkflow({ entry: "researcher", steps: [...] });// In your gang config
tools: {
custom: [
{
name: "database_query",
module: "./tools/database.js",
export: "queryDatabase"
}
]
}
```## 7. Library usage (as a module)
You can use Revulation programmatically from JS/TS.
### 7.1. Importing core components
```js
import { createLLM, CreditManager, ChatAgent, ToolsAgent, CodingAgent } from "revulation-cli";From this repo (without publishing), you can import directly from src:
import { createLLM } from "./src/config/llm.js";
import { CreditManager } from "./src/config/credits.js";
import { ChatAgent } from "./src/agents/chatAgent.js";
import { ToolsAgent } from "./src/agents/toolsAgent.js";
import { CodingAgent } from "./src/agents/codingAgent.js";
import { GangEngine, createGang, createMember, createWorkflow } from "./src/workflows/gangEngine.js";import { GangEngine, createGang } from "./src/workflows/gangEngine.js";
const gangConfig = {
name: "my-gang",
version: 1,
llm: { model: "GLM-4.5-Flash", temperature: 0.4 },
members: [
{ name: "worker", role: "Simple worker", tools: [], memoryId: "shared" }
],
workflow: { entry: "worker" }
};
const engine = new GangEngine({ config: gangConfig });
const run = await engine.runOnce("Design a note-taking app and generate tests.");
console.log(run.final);For tests or custom setups you can inject a fake or custom LLM:
const engine = new CrewEngine({
yamlPath: "./workflows/my_workflow.yaml",
llmFactory: (opts) => myCustomLlmInstance,
});Unit tests use Node's built-in node:test framework.
npm testThis runs everything under tests/, including:
tests/crewEngine.test.js: basic coverage ofCrewEngine(backward compatibility maintained)tests/gangEngine.test.js: coverage of newGangEngineJavaScript-based workflow framework:runOncewith a simple agent and fake LLMevaluateTestAssertionswithcontainsassertionsrunTestsend-to-end, including JSON + Markdown report generation
To avoid calling the real LLM and external tools, tests inject a fake LLM using llmFactory:
- The fake LLM implements
invoke(messages)and returns a fixed JSON payload. - This keeps tests deterministic and fast, and they do not require
GLM_API_KEY.
- Create
workflows/product.yamldescribing aresearcher,architect, andtesterteam. - Run:
revulation crew workflows/product.yaml -i "Design a habit-tracking mobile app."- Inspect the final node and (if enabled) the observability report under
workflows/reports/.
- Add
tests:to your workflow YAML with severalinput+asserts. - Run:
revulation crew workflows/product.yaml --tests- Check
workflows/crew_reports/product_tests.jsonand.mdfor pass/fail status.
- Implement a LangChain
toolinmyTools/runShell.js. - Register it in the YAML under
tools.custom. - Add it to an agent's
toolslist. - The agent can now call this tool in multi-step workflows.
- The workflow engine currently assumes a single shared LLM instance per workflow file.
- Agent JSON outputs must be reasonably small; extremely large responses may slow down routing and reports.
- Only one assertion type (
contains) is implemented initially; you can extendevaluateTestAssertionsto support more. - Tool usage in workflows currently relies on models following the JSON-only instruction; in practice you may want to harden the prompts or add a JSON repair step.
Contributions and improvements (more assertion types, richer graphs, better error handling) can be layered on top of this foundation.
