A blazing-fast, agentic CLI tool powered by Groq + LLaMA 3.3 70b that understands natural language commands and autonomously manages your filesystem - with persistent memory via PostgreSQL.
Features β’ How It Works β’ Installation β’ Database Setup β’ Usage β’ Tools
| Feature | Description | |
|---|---|---|
| π§ | Natural Language | Just type what you want - no flags, no syntax to remember |
| π | Multi-Tool Chaining | Agent calls multiple tools automatically in a single request |
| πΎ | Persistent Memory | Full conversation history stored in PostgreSQL across your session |
| β‘ | Groq Powered | Blazing fast LLM inference with LLaMA 3.3 70b |
| π¬ | Two Modes | Single command or full interactive chat session |
| ποΈ | Clean Architecture | Fully typed TypeScript with clear separation of concerns |
You type a natural language command
β
βΌ
Commander.js parses CLI
β
βΌ
Load conversation history
from PostgreSQL
β
βΌ
Groq LLM decides which
tool(s) to call
β
βΌ
ββββββββ Multi-Tool Loop βββββββββββ
β β
β toolRunner executes the tool β
β result is fed back to the LLM β
β repeats until task is complete β
β β
ββββββββββββββββββββββββββββββββββββ
β
βΌ
Natural language response
saved to PostgreSQL + printed
This is the ReAct agentic loop - the same pattern used by Gemini CLI, Claude Code, and other modern AI agents.
groq-fs-agent/
βββ src/
β βββ agent/
β β βββ agent.ts # Core AI loop with multi-tool chaining
β β βββ toolRunner.ts # Maps LLM tool calls β real functions
β βββ config/
β β βββ groq.ts # Groq client initialization
β βββ db/
β β βββ database.ts # PostgreSQL pool + connection management
β β βββ memory.ts # Save & retrieve conversation history
β β βββ schema.sql # Table definitions (reference)
β βββ tools/
β β βββ createFile.ts
β β βββ readFile.ts
β β βββ scanFiles.ts
β β βββ editFile.ts
β β βββ deleteFile.ts
β β βββ index.ts # Barrel exports
β βββ utils/
β β βββ logger.ts # ANSI color logger (zero dependencies)
β βββ index.ts # CLI entry point
βββ .env.example
βββ .gitignore
βββ tsconfig.json
βββ package.json
Before you begin, make sure you have:
- Node.js v18 or higher
- PostgreSQL v14 or higher
- A free Groq API key
1. Clone the repository
git clone https://github.com/Darsh-Nandu/groq-fs-agent.git
cd groq-fs-agent2. Install dependencies
npm install3. Set up environment variables
cp .env.example .envThen open .env and fill in your values - see Configuration below.
Windows (PowerShell):
net start postgresql-x64-16macOS:
brew services start postgresqlLinux:
sudo service postgresql startpsql -U postgresCREATE DATABASE groq_agent_db;
-- verify it exists
\l
-- exit
\qNo migrations needed. On first run, the agent automatically creates this table:
CREATE TABLE IF NOT EXISTS messages (
id SERIAL PRIMARY KEY,
session_id VARCHAR(255) NOT NULL,
role VARCHAR(50) NOT NULL,
content TEXT NOT NULL,
tool_name VARCHAR(100),
tool_result TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);Your .env file should look like this:
# βββ Groq ββββββββββββββββββββββββββββββββββββββββ
# Get your free API key at https://console.groq.com
GROQ_API_KEY=your_groq_api_key_here
# βββ PostgreSQL ββββββββββββββββββββββββββββββββββ
DB_HOST=localhost
DB_PORT=5432
DB_NAME=groq_agent_db
DB_USER=postgres
DB_PASSWORD=your_postgres_passwordPerfect for quick one-off tasks:
npm run dev ask "create a file called hello.ts with a hello world function"Full conversation with memory - the agent remembers everything you say:
npm run dev chatSpecial commands inside chat:
| Command | Action |
|---|---|
exit |
Quit the agent |
clear |
Wipe memory for the current session |
| Tool | What it does | Try saying... |
|---|---|---|
create_file |
Creates a new file with content | "create a file called server.ts with express boilerplate" |
read_file |
Reads and displays a file | "read the file package.json" |
scan_files |
Lists all files in a directory | "scan the src folder" |
edit_file |
Overwrites a file with new content | "edit hello.ts and add a goodbye function" |
delete_file |
Deletes a file permanently | "delete the file temp.txt" |
$ npm run dev ask "create a file called notes.ts and then read it back to me"
[Agent] Processing: "create a file called notes.ts and then read it back to me"
[Tool] Running tool: create_file
v Created file: notes.ts
[Tool] Running tool: read_file
v Read file: notes.ts
[Agent] Done! I created notes.ts and here's what it contains: ...$ npm run dev chat
[Agent] Interactive mode started! Type 'exit' to quit, 'clear' to reset memory.
ββββββββββββββββββββββββββββββββββββββββββββββββββ
You: My name is Darsh
[Agent] Hey Darsh! How can I help you today?
You: scan the current directory
[Tool] Running tool: scan_files
v Scanned directory: ./
[Agent] Here are the contents of your current directory: ...
You: what is my name?
[Agent] Your name is Darsh - you told me at the start of our conversation!
You: exit
[Agent] Goodbye!| Technology | Purpose |
|---|---|
| TypeScript 5.4 | Type-safe, production-grade codebase |
| Groq SDK | Ultra-fast LLM inference with LLaMA 3.3 70b |
| Commander.js | CLI argument and command parsing |
| PostgreSQL + pg | Persistent conversation memory |
| uuid | Unique session ID per conversation |
| dotenv | Secure environment variable management |
| Node.js fs | Native filesystem operations |