jiva-core 0.3.23-dev.322ee7e → 0.3.41-dev.fe6fe48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +232 -560
  2. package/dist/code/agent.d.ts +105 -0
  3. package/dist/code/agent.d.ts.map +1 -0
  4. package/dist/code/agent.js +837 -0
  5. package/dist/code/agent.js.map +1 -0
  6. package/dist/code/file-lock.d.ts +15 -0
  7. package/dist/code/file-lock.d.ts.map +1 -0
  8. package/dist/code/file-lock.js +36 -0
  9. package/dist/code/file-lock.js.map +1 -0
  10. package/dist/code/lsp/client.d.ts +30 -0
  11. package/dist/code/lsp/client.d.ts.map +1 -0
  12. package/dist/code/lsp/client.js +181 -0
  13. package/dist/code/lsp/client.js.map +1 -0
  14. package/dist/code/lsp/language.d.ts +12 -0
  15. package/dist/code/lsp/language.d.ts.map +1 -0
  16. package/dist/code/lsp/language.js +145 -0
  17. package/dist/code/lsp/language.js.map +1 -0
  18. package/dist/code/lsp/manager.d.ts +39 -0
  19. package/dist/code/lsp/manager.d.ts.map +1 -0
  20. package/dist/code/lsp/manager.js +108 -0
  21. package/dist/code/lsp/manager.js.map +1 -0
  22. package/dist/code/lsp/server.d.ts +15 -0
  23. package/dist/code/lsp/server.d.ts.map +1 -0
  24. package/dist/code/lsp/server.js +78 -0
  25. package/dist/code/lsp/server.js.map +1 -0
  26. package/dist/code/tools/bash.d.ts +3 -0
  27. package/dist/code/tools/bash.d.ts.map +1 -0
  28. package/dist/code/tools/bash.js +110 -0
  29. package/dist/code/tools/bash.js.map +1 -0
  30. package/dist/code/tools/edit.d.ts +11 -0
  31. package/dist/code/tools/edit.d.ts.map +1 -0
  32. package/dist/code/tools/edit.js +459 -0
  33. package/dist/code/tools/edit.js.map +1 -0
  34. package/dist/code/tools/glob.d.ts +3 -0
  35. package/dist/code/tools/glob.d.ts.map +1 -0
  36. package/dist/code/tools/glob.js +62 -0
  37. package/dist/code/tools/glob.js.map +1 -0
  38. package/dist/code/tools/grep.d.ts +3 -0
  39. package/dist/code/tools/grep.d.ts.map +1 -0
  40. package/dist/code/tools/grep.js +147 -0
  41. package/dist/code/tools/grep.js.map +1 -0
  42. package/dist/code/tools/index.d.ts +31 -0
  43. package/dist/code/tools/index.d.ts.map +1 -0
  44. package/dist/code/tools/index.js +9 -0
  45. package/dist/code/tools/index.js.map +1 -0
  46. package/dist/code/tools/read.d.ts +3 -0
  47. package/dist/code/tools/read.d.ts.map +1 -0
  48. package/dist/code/tools/read.js +120 -0
  49. package/dist/code/tools/read.js.map +1 -0
  50. package/dist/code/tools/spawn.d.ts +3 -0
  51. package/dist/code/tools/spawn.d.ts.map +1 -0
  52. package/dist/code/tools/spawn.js +49 -0
  53. package/dist/code/tools/spawn.js.map +1 -0
  54. package/dist/code/tools/write.d.ts +3 -0
  55. package/dist/code/tools/write.d.ts.map +1 -0
  56. package/dist/code/tools/write.js +82 -0
  57. package/dist/code/tools/write.js.map +1 -0
  58. package/dist/core/agent-interface.d.ts +54 -0
  59. package/dist/core/agent-interface.d.ts.map +1 -0
  60. package/dist/core/agent-interface.js +8 -0
  61. package/dist/core/agent-interface.js.map +1 -0
  62. package/dist/core/agent-spawner.d.ts.map +1 -1
  63. package/dist/core/agent-spawner.js +3 -0
  64. package/dist/core/agent-spawner.js.map +1 -1
  65. package/dist/core/client-agent.d.ts +22 -2
  66. package/dist/core/client-agent.d.ts.map +1 -1
  67. package/dist/core/client-agent.js +145 -26
  68. package/dist/core/client-agent.js.map +1 -1
  69. package/dist/core/config.d.ts +144 -17
  70. package/dist/core/config.d.ts.map +1 -1
  71. package/dist/core/config.js +25 -1
  72. package/dist/core/config.js.map +1 -1
  73. package/dist/core/conversation-manager.d.ts +4 -1
  74. package/dist/core/conversation-manager.d.ts.map +1 -1
  75. package/dist/core/conversation-manager.js +47 -17
  76. package/dist/core/conversation-manager.js.map +1 -1
  77. package/dist/core/dual-agent.d.ts +18 -5
  78. package/dist/core/dual-agent.d.ts.map +1 -1
  79. package/dist/core/dual-agent.js +152 -59
  80. package/dist/core/dual-agent.js.map +1 -1
  81. package/dist/core/manager-agent.d.ts +38 -2
  82. package/dist/core/manager-agent.d.ts.map +1 -1
  83. package/dist/core/manager-agent.js +144 -23
  84. package/dist/core/manager-agent.js.map +1 -1
  85. package/dist/core/types/agent-context.d.ts +30 -0
  86. package/dist/core/types/agent-context.d.ts.map +1 -0
  87. package/dist/core/types/agent-context.js +8 -0
  88. package/dist/core/types/agent-context.js.map +1 -0
  89. package/dist/core/types/completion-signal.d.ts +17 -0
  90. package/dist/core/types/completion-signal.d.ts.map +1 -0
  91. package/dist/core/types/completion-signal.js +8 -0
  92. package/dist/core/types/completion-signal.js.map +1 -0
  93. package/dist/core/utils/serialize-agent-context.d.ts +23 -0
  94. package/dist/core/utils/serialize-agent-context.d.ts.map +1 -0
  95. package/dist/core/utils/serialize-agent-context.js +75 -0
  96. package/dist/core/utils/serialize-agent-context.js.map +1 -0
  97. package/dist/core/worker-agent.d.ts +14 -3
  98. package/dist/core/worker-agent.d.ts.map +1 -1
  99. package/dist/core/worker-agent.js +261 -68
  100. package/dist/core/worker-agent.js.map +1 -1
  101. package/dist/index.d.ts +6 -0
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +3 -0
  104. package/dist/index.js.map +1 -1
  105. package/dist/interfaces/cli/index.js +146 -25
  106. package/dist/interfaces/cli/index.js.map +1 -1
  107. package/dist/interfaces/cli/repl.d.ts +8 -2
  108. package/dist/interfaces/cli/repl.d.ts.map +1 -1
  109. package/dist/interfaces/cli/repl.js +39 -3
  110. package/dist/interfaces/cli/repl.js.map +1 -1
  111. package/dist/interfaces/cli/setup-wizard.d.ts.map +1 -1
  112. package/dist/interfaces/cli/setup-wizard.js +92 -0
  113. package/dist/interfaces/cli/setup-wizard.js.map +1 -1
  114. package/dist/interfaces/http/routes/chat.js +2 -2
  115. package/dist/interfaces/http/routes/chat.js.map +1 -1
  116. package/dist/interfaces/http/session-manager.d.ts +7 -4
  117. package/dist/interfaces/http/session-manager.d.ts.map +1 -1
  118. package/dist/interfaces/http/session-manager.js +56 -15
  119. package/dist/interfaces/http/session-manager.js.map +1 -1
  120. package/dist/models/base.d.ts +16 -1
  121. package/dist/models/base.d.ts.map +1 -1
  122. package/dist/models/harmony.d.ts +7 -1
  123. package/dist/models/harmony.d.ts.map +1 -1
  124. package/dist/models/harmony.js +21 -3
  125. package/dist/models/harmony.js.map +1 -1
  126. package/dist/models/krutrim.d.ts +31 -1
  127. package/dist/models/krutrim.d.ts.map +1 -1
  128. package/dist/models/krutrim.js +55 -11
  129. package/dist/models/krutrim.js.map +1 -1
  130. package/dist/models/orchestrator.d.ts +24 -0
  131. package/dist/models/orchestrator.d.ts.map +1 -1
  132. package/dist/models/orchestrator.js +40 -6
  133. package/dist/models/orchestrator.js.map +1 -1
  134. package/package.json +8 -5
package/README.md CHANGED
@@ -1,699 +1,381 @@
1
- # Jiva - Versatile Autonomous AI Agent
1
+ # Jiva
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/jiva-core.svg)](https://www.npmjs.com/package/jiva-core) [![License](https://img.shields.io/github/license/KarmaloopAI/Jiva.svg)](LICENSE) [![GitHub stars](https://img.shields.io/github/stars/KarmaloopAI/Jiva.svg?style=social&label=Star)](https://github.com/KarmaloopAI/Jiva)
3
+ [![npm version](https://img.shields.io/npm/v/jiva-core.svg)](https://www.npmjs.com/package/jiva-core)
4
+ [![License](https://img.shields.io/github/license/KarmaloopAI/Jiva.svg)](LICENSE)
5
+ [![GitHub stars](https://img.shields.io/github/stars/KarmaloopAI/Jiva.svg?style=social&label=Star)](https://github.com/KarmaloopAI/Jiva)
4
6
 
5
- Jiva is a powerful autonomous AI agent with a three-agent architecture (Manager, Worker, Client) powered by gpt-oss-120b with full MCP (Model Context Protocol) support. Deploy as a CLI tool or scale to production on Google Cloud Run.
6
-
7
- ## Quick Links
8
-
9
- - **[Quick Start Guide](docs/guides/QUICKSTART.md)** - Get up and running in 30 seconds
10
- - **[Cloud Run Deployment](docs/deployment/CLOUD_RUN_DEPLOYMENT.md)** - Deploy to production
11
- - **[Configuration Guide](docs/guides/CONFIGURATION.md)** - Detailed configuration and provider setup
12
- - **[Documentation](docs/README.md)** - Complete documentation index
13
- - **[Build Instructions](docs/guides/BUILD.md)** - Detailed setup and development workflow
14
- - **[Troubleshooting](docs/guides/TROUBLESHOOTING.md)** - Common issues and solutions
7
+ Jiva is an autonomous AI agent for the terminal and cloud. It works with any OpenAI-compatible model provider and supports two execution modes — a general-purpose two-agent system (Manager + Worker) for complex tasks, and a code-optimized single-loop engine with LSP integration for software engineering.
15
8
 
16
9
  ## Demo
17
10
 
18
11
  ![Demo](jiva-new-demo.gif)
19
12
 
20
- ## Features
21
-
22
- ### Core Capabilities
23
- - **Three-Agent Architecture**: Manager for planning, Worker for execution, Client for quality validation
24
- - **Adaptive Quality Control**: Client agent uses tiered validation (MINIMAL→STANDARD→THOROUGH) based on task complexity
25
- - **Unjustified Failure Detection**: LLM-powered analysis catches agents giving up without trying
26
- - **Cloud-Ready Deployment**: Run on Google Cloud Run with auto-scaling, WebSocket support, and GCS storage
27
- - **Multi-Tenancy**: Per-tenant isolation with authenticated session management
28
- - **Provider Agnostic**: Works with Krutrim, Groq, OpenAI, Ollama, and any OpenAI-compatible API
29
- - **MCP Integration**: Seamless integration with Model Context Protocol servers for extensible tooling
30
- - **Smart Conversations**: Auto-save, restore, and AI-generated titles for all conversations
31
- - **Directive-Based**: Orient agent behavior with custom `jiva-directive.md` files
32
- - **Storage Abstraction**: Local filesystem or cloud storage (GCS, future: S3, Redis)
33
-
34
- ### v0.3.1 Features
35
- - **Production Deployment**: One-command Cloud Run deployment with GCS persistence
36
- - **Client Agent**: Intelligent validation that ensures work quality and catches false failures
37
- - **HTTP/WebSocket API**: RESTful endpoints and real-time bidirectional communication
38
- - **Authentication**: Firebase Auth, custom JWT, or development mode
39
- - **Session Management**: Auto-scaling agent instances with idle timeout and cleanup
40
- - **Container Orchestration**: Multi-stage Docker builds, health probes, graceful shutdown
41
- - **Personas & Skills**: 100% compatible with Claude's Skills/Plugins system - extend Jiva with domain-specific capabilities
42
-
43
- ### Personas (Skills & Plugins)
44
-
45
- Jiva supports persona-based skill management, fully compatible with Claude's Skills/Plugins system:
46
-
47
- ```bash
48
- # List available personas
49
- jiva persona list
50
-
51
- # Activate a persona
52
- jiva persona activate data-analyst
53
-
54
- # Create your own skill
55
- jiva persona create-skill my-skill \
56
- --description "Custom functionality" \
57
- --author "Your Name"
58
-
59
- # Package and distribute
60
- jiva persona package-skill my-skill
61
- ```
62
-
63
- **Key Features:**
64
- - **Progressive Disclosure**: Skills load only what's needed (L1→L2→L3)
65
- - **Automatic Routing**: Agent selects skills based on user request
66
- - **Composable**: Bundle skills, commands, agents, and MCP servers
67
- - **Portable**: Same .skill files work on Claude and Jiva
68
-
69
- See **[Personas Guide](docs/guides/PERSONAS.md)** for complete documentation.
70
-
71
- ### v0.3.2 Bug Fixes & Quality Improvements
72
- **Bug Fixes:**
73
- - **Persona Isolation**: Sub-agents now use ephemeral personas that don't overwrite parent agent configuration
74
- - **Context Propagation**: Workspace directory automatically injected into all sub-agent task messages
75
- - **Enhanced Logging**: Persona context included in all log messages for better multi-agent debugging
76
- - **Reduced Hallucination**: Temperature lowered from 0.3-0.7 to 0.1-0.2 for more deterministic, fact-based behavior
77
-
78
- **HTTP/Cloud Compatibility:**
79
- - **🚨 Per-Tenant Persona Config** (CRITICAL): Fixed cross-tenant persona configuration leakage - each tenant's settings now isolated in GCS
80
- - **Session-Scoped Logging**: Fixed persona context race conditions in concurrent HTTP sessions
81
- - **Cloud-Aware Orchestration**: Orchestration logs now persist to cloud storage (GCS/S3) instead of ephemeral filesystem
82
-
83
- **Quality Improvements:**
84
- - **LLM-Based Validation**: Client agent uses semantic analysis instead of keyword matching for involvement level detection
85
- - **Coherence Checking**: Detects when Worker fabricates accomplishments not supported by actual tool usage
86
- - **Robust Plan Parsing**: Manager agent parsing with JSON format, LLM cleanup fallback, and garbage filtering
87
- - **Client Logging**: Full orchestration traceability for validation decisions and quality control
88
-
89
- **⚠️ CRITICAL:** If running in HTTP/Cloud mode (v0.3.1+), **upgrade immediately**:
90
- - v0.3.1 has cross-tenant configuration leakage (security issue)
91
- - v0.3.2 fixes multi-tenant isolation with per-tenant storage
92
-
93
- ### v0.2.1 Features
94
- - **Dual-Agent System**: Separate Manager and Worker agents for better task focus and reliability
95
- - **Chain-of-Thought Logging**: Transparent reasoning at INFO level with clean ASCII formatting
96
- - **Robust Error Recovery**: Automatic retry with error feedback for API and tool failures
97
- - **Workspace-Aware Operations**: Smart path resolution for file operations
98
- - **Slash Commands**: Use `/help`, `/load`, `/save`, `/list` for easy conversation management
99
- - **Smart Tool Format Detection**: Auto-detects Harmony vs Standard OpenAI tool calling format
100
-
101
- See [release notes](docs/release_notes/) for detailed version history.
13
+ ---
102
14
 
103
15
  ## Installation
104
16
 
105
- ### Global Install (Recommended)
106
-
107
17
  ```bash
108
18
  npm install -g jiva-core
109
- ```
110
-
111
- After installation, run the setup wizard:
112
-
113
- ```bash
114
19
  jiva setup
115
20
  ```
116
21
 
117
- ### Development Install
118
-
119
- ```bash
120
- git clone https://github.com/KarmaloopAI/Jiva.git
121
- cd jCLI Mode (Local Development)
22
+ The setup wizard prompts for your API endpoint, key, and model name. Jiva works with Krutrim, Groq, OpenAI, Ollama, and any OpenAI-compatible provider.
122
23
 
123
- #### 1. Install Jiva
24
+ ### Development install
124
25
 
125
26
  ```bash
126
- npm install -g jiva-core
27
+ git clone https://github.com/KarmaloopAI/Jiva.git
28
+ cd Jiva
29
+ npm install && npm run build && npm link
30
+ jiva setup
127
31
  ```
128
32
 
129
- #### 2. First-Time Setup
33
+ ---
130
34
 
131
- Run the interactive setup wizard:
35
+ ## Quick Start
132
36
 
133
37
  ```bash
134
- jiva setup
135
- ```
38
+ # General-purpose interactive session
39
+ jiva chat
136
40
 
137
- You'll be prompted for:
138
- - Krutrim API endpoint (default: `https://cloud.olakrutrim.com/v1/chat/completions`)
139
- - API key for gpt-oss-120b ([Get your API key](https://cloud.olakrutrim.com))
140
- - Optional multimodal model (Llama-4-Maverick-17B)
141
- - MCP server configuration
41
+ # Code mode — optimized for software engineering tasks
42
+ jiva chat --code
142
43
 
143
- #### 3. Start Chatting
44
+ # Code mode with plan-then-approve flow
45
+ jiva chat --code --plan
144
46
 
145
- Launch interactive mode:
47
+ # Single prompt
48
+ jiva run "What changed in the last 5 commits?"
146
49
 
147
- ```bash
148
- jiva chat
50
+ # Single prompt in code mode
51
+ jiva run "Add error handling to the database module" --code
149
52
  ```
150
53
 
151
- **Try these commands:**
152
- ```bash
153
- You: /help # Show all available commands
154
- You: /servers # Check MCP server status
155
- You: /tools # List all available tools
156
- You: List files in this directory
157
- You: /save # Save this conversation
158
- You: /list # View all saved conversations
159
- ```
54
+ ### REPL commands
160
55
 
161
- ### Cloud Run Mode (Production)
56
+ | Command | Description |
57
+ |---------|-------------|
58
+ | `/help` | Show available commands |
59
+ | `/tools` | List active tools |
60
+ | `/servers` | Show MCP server status |
61
+ | `/save` | Save current conversation |
62
+ | `/load` | Resume a saved conversation |
63
+ | `/list` | Browse all saved conversations |
64
+ | `/reset` | Clear conversation history |
65
+ | `/exit` | Exit Jiva |
162
66
 
163
- Deploy Jiva as an auto-scaling HTTP/WebSocket service:
67
+ ---
164
68
 
165
- #### 1. Prerequisites
69
+ ## Execution Modes
166
70
 
167
- - Google Cloud account with billing enabled
168
- - `gcloud` CLI installed and configured
169
- - Docker installed (for local testing)
71
+ ### General mode (default)
170
72
 
171
- #### 2. One-Command Deployment
73
+ A two-agent pipeline designed for complex, multi-step tasks:
172
74
 
173
- ```bash
174
- git clone https://github.com/KarmaloopAI/Jiva.git
175
- cd jiva
176
- ./deploy.sh YOUR_PROJECT_ID us-central1
75
+ ```
76
+ User Request
77
+
78
+ Manager Agent — plans, decomposes, and synthesizes
79
+
80
+ Worker Agent — executes subtasks with MCP tools
81
+
82
+ Response
177
83
  ```
178
84
 
179
- The script automatically:
180
- - Enables required GCP APIs
181
- - Creates GCS bucket for state storage
182
- - Configures service account and IAM roles
183
- - Builds and deploys container to Cloud Run
184
- - Outputs service URL
85
+ The Worker has access to any configured MCP server (filesystem, browser automation, shell commands, etc.). The Manager synthesizes results from all subtasks into a final coherent response. Simple conversational messages are answered directly without executing subtasks.
185
86
 
186
- #### 3. Test Deployment
87
+ ### Code mode (`--code`)
187
88
 
188
- ```bash
189
- SERVICE_URL=$(gcloud run services describe jiva --region=us-central1 --format='value(status.url)')
89
+ A single streaming loop optimized for coding tasks:
190
90
 
191
- # Health check
192
- curl $SERVICE_URL/health
193
-
194
- # Chat endpoint (with auth bypass for testing)
195
- curl -X POST $SERVICE_URL/api/chat \
196
- -H "Content-Type: application/json" \
197
- -H "X-Session-Id: test-session" \
198
- -d '{"message": "Hello, Jiva!"}'
199
91
  ```
92
+ User Request
93
+
94
+ CodeAgent
95
+ loop until done:
96
+ LLM call with tool definitions
97
+
98
+ Tool execution (in-process, no subprocess)
99
+
100
+ LSP feedback after file edits
101
+
102
+ Response
103
+ ```
104
+
105
+ Code mode reduces latency by eliminating inter-agent overhead and running all file tools directly in the Node.js process. It includes a multi-strategy edit engine that reliably handles indentation drift and whitespace inconsistencies.
106
+
107
+ **Available tools in code mode:**
108
+
109
+ | Tool | Description |
110
+ |------|-------------|
111
+ | `read_file` | Read files with line numbers, list directories |
112
+ | `edit_file` | Multi-strategy string replacement (9 strategies) |
113
+ | `write_file` | Create or overwrite files |
114
+ | `glob` | Find files by pattern |
115
+ | `grep` | Regex content search |
116
+ | `bash` | Run shell commands |
117
+ | `spawn_code_agent` | Delegate a sub-task to a child agent |
118
+
119
+ **LSP integration:** After each file edit, Jiva notifies the appropriate language server and appends any compiler errors to the tool result. Language servers are auto-detected from your PATH. If none is installed for a given language, the tool continues silently.
200
120
 
201
- **Full deployment guide:** [Cloud Run Deployment](docs/deployment/CLOUD_RUN_DEPLOYMENT.md)ry these commands:**
202
121
  ```bash
203
- You: /help # Show all available commands
204
- You: /servers # Check MCP server status
205
- You: /tools # List all available tools
206
- You: List files in this directory
207
- You: /save # Save this conversation
208
- You: /list # View all saved conversations
122
+ # Install language servers (optional but recommended for code mode)
123
+ npm install -g typescript-language-server typescript # TypeScript / JavaScript
124
+ pip install python-lsp-server # Python
125
+ go install golang.org/x/tools/gopls@latest # Go
126
+ rustup component add rust-analyzer # Rust
209
127
  ```
210
128
 
211
- ### 4. Advanced Usage
129
+ For a complete technical reference see [Code Mode Architecture](docs/architecture/CODE_MODE.md).
212
130
 
213
- **View current configuration:**
214
- ```bash
215
- jiva config --show
216
- ```
131
+ ---
217
132
 
218
- **Use a custom configuration file:**
219
- ```bash
220
- jiva chat --config ./my-project-config.json
221
- jiva run "analyze code" --config ./team-config.json
222
- ```
133
+ ## Configuration
223
134
 
224
- **Custom workspace and directive:**
225
135
  ```bash
226
- jiva chat --workspace /path/to/project --directive ./project-directive.md
227
- ```
136
+ # Run setup wizard
137
+ jiva setup
228
138
 
229
- **Single command execution:**
230
- ```bash
231
- jiva run "Analyze the code in this directory and suggest improvements"
232
- ```
139
+ # View or update settings interactively
140
+ jiva config
233
141
 
234
- **Enable debug mode:**
235
- ```bash
236
- jiva chat --debug
142
+ # View current configuration and file path
143
+ jiva config --show
237
144
  ```
238
145
 
239
- ### 5. Example Workflows
146
+ Configuration is stored at `~/.config/jiva-nodejs/config.json` (Linux/macOS) or `%APPDATA%\jiva-nodejs\config.json` (Windows).
240
147
 
241
- **Code Review:**
242
- ```bash
243
- You: Review all TypeScript files and identify potential bugs
244
- Jiva: *Uses filesystem to read files, analyzes code, provides detailed review*
245
- ```
148
+ ### Provider examples
246
149
 
247
- **Web Research:**
248
- ```bash
249
- You: Open Hacker News and summarize the top 5 articles
250
- Jiva: *Uses playwright to navigate, scrape content, and summarize*
150
+ **Krutrim (gpt-oss-120b)**
151
+ ```json
152
+ {
153
+ "models": {
154
+ "reasoning": {
155
+ "endpoint": "https://cloud.olakrutrim.com/v1/chat/completions",
156
+ "apiKey": "kr-...",
157
+ "model": "gpt-oss-120b",
158
+ "type": "reasoning",
159
+ "useHarmonyFormat": true
160
+ }
161
+ }
162
+ }
251
163
  ```
252
164
 
253
- **System Administration:**
254
- ```bash
255
- You: Check disk usage and list the 10 largest directories
256
- Jiva: *Uses desktop-commander to run du commands and analyze output*
165
+ **Groq**
166
+ ```json
167
+ {
168
+ "models": {
169
+ "reasoning": {
170
+ "endpoint": "https://api.groq.com/openai/v1/chat/completions",
171
+ "apiKey": "gsk_...",
172
+ "model": "openai/gpt-oss-20b",
173
+ "type": "reasoning"
174
+ }
175
+ }
176
+ }
257
177
  ```
258
178
 
259
- **Conversation Management:**
260
- ```bash
261
- You: /list # Browse previous conversations
262
- You: /load # Resume a conversation
263
- # Select from interactive menu with arrow keys
264
- You: Continue where we left off
179
+ **Ollama (local)**
180
+ ```json
181
+ {
182
+ "models": {
183
+ "reasoning": {
184
+ "endpoint": "http://localhost:11434/v1/chat/completions",
185
+ "apiKey": "not-needed",
186
+ "model": "llama3.1",
187
+ "type": "reasoning"
188
+ }
189
+ }
190
+ }
265
191
  ```
266
192
 
267
- ## Configuration
268
-
269
- Configuration is stored in your system's config directory (managed by `conf` package).
270
-
271
- ### View Configuration Location
193
+ ### Code mode configuration
272
194
 
273
- ```bash
274
- jiva config
195
+ ```json
196
+ {
197
+ "codeMode": {
198
+ "enabled": true,
199
+ "lsp": { "enabled": true },
200
+ "maxIterations": 50
201
+ }
202
+ }
275
203
  ```
276
204
 
277
- ### Manual Configuration
205
+ Full configuration reference: [Configuration Guide](docs/guides/CONFIGURATION.md)
278
206
 
279
- You can also manually edit the config file. Location varies by OS:
280
- - macOS: `~/Library/Preferences/jiva-nodejs/`
281
- - Linux: `~/.config/jiva-nodejs/`
282
- - Windows: `%APPDATA%\jiva-nodejs\`
207
+ ---
283
208
 
284
209
  ## Directive Files
285
210
 
286
- Jiva can be oriented with a `jiva-directive.md` file that defines its purpose, tasks, and constraints.
287
-
288
- ### Example Directive
289
-
290
- Create a file called `jiva-directive.md`:
211
+ Create a `jiva-directive.md` in your project root to orient the agent to your codebase:
291
212
 
292
213
  ```markdown
293
214
  # Purpose
294
-
295
- You are a code review assistant focused on identifying security vulnerabilities
296
- and suggesting performance improvements in Python projects.
215
+ Code review assistant for a Django web application.
297
216
 
298
217
  # Tasks
299
-
300
- - Scan Python files for common security issues (SQL injection, XSS, etc.)
218
+ - Scan for security vulnerabilities (SQLi, XSS, CSRF)
301
219
  - Identify performance bottlenecks
302
220
  - Suggest modern Python best practices
303
- - Check for outdated dependencies
304
221
 
305
222
  # Constraints
306
-
307
- - Only analyze Python files (.py)
308
- - Do not modify code without explicit approval
309
- - Prioritize security issues over style improvements
223
+ - Only analyze .py files
224
+ - Do not modify files without explicit approval
310
225
 
311
226
  # Context
312
-
313
- This project is a Django web application with a PostgreSQL database.
314
- It handles sensitive user data and must comply with GDPR.
227
+ PostgreSQL backend, GDPR-sensitive user data.
315
228
  ```
316
229
 
317
- Jiva will automatically look for this file in:
318
- 1. Path specified with `--directive` flag
319
- 2. `jiva-directive.md` in workspace root
320
- 3. `.jiva/directive.md` in workspace root
321
-
322
- ## MCP Servers
323
-
324
- Jiva leverages the Model Context Protocol (MCP) to provide extensible tooling. It comes pre-configured with the Filesystem server and makes it easy to add more.
325
-
326
- ### Default Server: Filesystem
230
+ Jiva searches for directive files automatically:
231
+ 1. Path given via `--directive`
232
+ 2. `jiva-directive.md` in the workspace root
233
+ 3. `.jiva/directive.md` in the workspace root
327
234
 
328
- Provides comprehensive file operations across user directories (subject to OS permissions).
235
+ ---
329
236
 
330
- - **Status:** Enabled by default
331
- - **Package:** `@modelcontextprotocol/server-filesystem`
332
- - **Access:** `/Users` (macOS/Linux) or `C:\Users` (Windows)
333
- - **Tools:** read_file, write_file, list_directory, create_directory, and more
334
- - **Details:** See [FILESYSTEM_ACCESS.md](docs/architecture/FILESYSTEM_ACCESS.md)
237
+ ## MCP Servers (general mode)
335
238
 
336
- ### Recommended Additional Servers
239
+ General mode uses MCP servers to extend the agent's capabilities. Jiva ships with the filesystem server enabled; additional servers can be added via `jiva config`.
337
240
 
338
- #### 1. Playwright MCP - Browser Automation
241
+ ### Recommended servers
339
242
 
340
- Control real browsers, take screenshots, scrape web content, and automate web interactions.
243
+ **Playwright** browser automation, web scraping, screenshot capture
341
244
 
342
245
  ```bash
343
- # Add Playwright MCP server
344
246
  jiva config
345
- # Select "MCP Servers" > "Add Server"
346
- # Name: playwright
347
- # Command: npx
348
- # Args: @playwright/mcp@latest
349
- # Enabled: true
247
+ # MCP Servers > Add Server
248
+ # Name: playwright Command: npx Args: @playwright/mcp@latest
350
249
  ```
351
250
 
352
- **Capabilities:**
353
- - 🌐 Navigate to URLs and interact with web pages
354
- - 📸 Take screenshots and extract page content
355
- - 🤖 Automate web forms and workflows
356
- - 🔍 Scrape data from websites
357
- - 📝 Fill forms and click buttons
358
-
359
- **Example usage:**
360
- ```
361
- You: Open LinkedIn and take a screenshot
362
- Jiva: *Uses playwright to open LinkedIn, waits for load, captures screenshot*
363
- ```
364
-
365
- #### 2. Desktop Commander - Shell Command Execution
366
-
367
- Execute shell commands, manage processes, and interact with the terminal.
251
+ **Desktop Commander** — shell command execution, process management
368
252
 
369
253
  ```bash
370
- # Add Desktop Commander MCP server
371
- jiva config
372
- # Select "MCP Servers" > "Add Server"
373
- # Name: desktop-commander
374
- # Command: npx
375
- # Args: -y desktop-commander
376
- # Enabled: true
254
+ # Name: desktop-commander Command: npx Args: -y desktop-commander
377
255
  ```
378
256
 
379
- **Capabilities:**
380
- - 💻 Execute shell commands (ls, grep, git, etc.)
381
- - 🔄 Start and manage background processes
382
- - 📊 Read process output with timeout control
383
- - 🎯 Session management for long-running commands
257
+ Other popular servers: GitHub, Postgres, Slack, Google Maps — see [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers).
384
258
 
385
- **Example usage:**
386
- ```
387
- You: Run npm test and show me the results
388
- Jiva: *Uses desktop-commander to execute tests and parse output*
389
- ```
390
-
391
- **⚠️ Security Note:** Desktop Commander can execute any shell command. Only enable if you understand the security implications and trust the agent.
392
-
393
- ### Other Available MCP Servers
259
+ ---
394
260
 
395
- The MCP ecosystem offers many more servers:
261
+ ## Cloud Deployment
396
262
 
397
- - **GitHub** (`@modelcontextprotocol/server-github`) - Repository management, issues, PRs
398
- - **Google Maps** (`@modelcontextprotocol/server-google-maps`) - Location data and mapping
399
- - **Slack** (`@modelcontextprotocol/server-slack`) - Team communication
400
- - **Postgres** (`@modelcontextprotocol/server-postgres`) - Database operations
401
- - **Git** (`@modelcontextprotocol/server-git`) - Version control operations
402
- - And more at [MCP Servers Repository](https://github.com/modelcontextprotocol/servers)
403
-
404
- ### Adding MCP Servers
405
-
406
- #### Via Interactive Config
263
+ Jiva can be deployed as a stateless, auto-scaling HTTP/WebSocket service on Google Cloud Run with GCS-backed session persistence and multi-tenant isolation.
407
264
 
408
265
  ```bash
409
- jiva config
410
- # Navigate: MCP Servers > Add Server
411
- # Fill in: name, command, args, enabled
412
- ```
413
-
414
- #### Via Manual Config Edit
415
-
416
- Edit your config file at `~/.config/jiva-nodejs/config.json` (Linux) or `~/Library/Preferences/jiva-nodejs/config.json` (macOS):
417
-
418
- ```json
419
- {
420
- "mcpServers": {
421
- "playwright": {
422
- "command": "npx",
423
- "args": ["@playwright/mcp@latest"],
424
- "enabled": true
425
- },
426
- "desktop-commander": {
427
- "command": "npx",
428
- "args": ["-y", "desktop-commander"],
429
- "enabled": true
430
- }
431
- }
432
- }
433
- ```
434
-
435
- #### Programmatically
436
-
437
- ```typescript
438
- ### Three-Agent System (v0.3.1)
439
-
440
- Jiva uses a three-agent architecture for intelligent task execution:
441
-
442
- ```
443
- User Request
444
-
445
- ┌────────────────┐
446
- │ Manager Agent │ Plans subtasks, coordinates workflow
447
- └────────┬───────┘
448
-
449
- ┌────────────────┐
450
- │ Worker Agent │ Executes subtasks with MCP tools
451
- └────────┬───────┘
452
-
453
- ┌────────────────┐
454
- │ Client Agent │ Validates outputs, ensures quality
455
- └────────┬───────┘
456
-
457
- Final Response
266
+ git clone https://github.com/KarmaloopAI/Jiva.git
267
+ cd Jiva
268
+ ./deploy.sh YOUR_PROJECT_ID us-central1
458
269
  ```
459
270
 
460
- **Manager Agent**: High-level planning and task decomposition
461
- **Worker Agent**: Tool execution and information gathering
462
- **Client Agent**: Adaptive validation and quality control (new in v0.3.1)
271
+ The deployment script enables required GCP APIs, creates the GCS bucket, configures IAM roles, and deploys the container. After deployment:
463
272
 
464
- The Client agent uses tiered involvement levels to balance quality with efficiency:
465
- - **MINIMAL**: Information requests metadata validation only
466
- - **STANDARD**: Creation tasks → file exists + basic checks
467
- - **THOROUGH**: Complex tasks or after failures → full E2E validation
273
+ ```bash
274
+ SERVICE_URL=$(gcloud run services describe jiva --region=us-central1 --format='value(status.url)')
468
275
 
469
- ### Project Structure
276
+ # Health check
277
+ curl $SERVICE_URL/health
470
278
 
279
+ # Chat via REST
280
+ curl -X POST $SERVICE_URL/api/chat \
281
+ -H "Content-Type: application/json" \
282
+ -H "X-Session-Id: my-session" \
283
+ -d '{"message": "Hello, Jiva!"}'
471
284
  ```
472
- jiva/
473
- ├── src/
474
- │ ├── core/ # Three-agent system
475
- │ │ ├── dual-agent.ts # Main orchestrator
476
- │ │ ├── manager-agent.ts # Planning & coordination
477
- │ │ ├── worker-agent.ts # Tool execution
478
- │ │ └── client-agent.ts # Quality validation (v0.3.1)
479
- │ ├── models/ # Model integrations and Harmony format
480
- │ ├── mcp/ # MCP client and server management
481
- │ ├── storage/ # Storage abstraction (v0.3.1)
482
- │ │ ├── local-provider.ts # Filesystem storage
483
- │ │ └── gcp-bucket-provider.ts # Cloud storage
484
- │ ├── interfaces/ # CLI and HTTP interfaces
485
- │ │ ├── cli/ # CLI interface
486
- │ │ └── http/ # Cloud Run HTTP/WebSocket (v0.3.1)
487
- │ └── utils/ # Utilities and helpers
488
- ```
489
-
490
- ### Key Components
491
-
492
- 1. **DualAgent**: Main orchestrator coordinating Manager, Worker, and Client agents
493
- 2. **ManagerAgent**: High-level planning, task breakdown, and result synthesis
494
- 3. **WorkerAgent**: Focused tool execution and information gathering
495
- 4. **ClientAgent**: Adaptive validation with unjustified failure detection
496
- 5. **ModelOrchestrator**: Manages multi-model coordination (reasoning + multimodal)
497
- 6. **MCPServerManager**: Handles MCP server lifecycle and tool discovery
498
- 7. **StorageProvider**: Unified interface for local/cloud persistence
499
- 8. **SessionManager**: Manages DualAgent lifecycle in cloud deployments
500
-
501
- **Troubleshooting MCP Issues:** See [TROUBLESHOOTING.md](docs/guides/TROUBLESHOOTING.md#mcp-server-issues)
502
-
503
- ### CLI/Library Mode
504
285
 
505
- ```typescript
506
- import {
507
- DualAgent,
508
- createKrutrimModel,
509
- ModelOrchestrator,
510
- MCPServerManager,
511
- WorkspaceManager,
512
- ConversationManager,
513
- createStorageProvider,
514
- } from 'jiva-core';
515
-
516
- // Create storage provider (auto-detects local/cloud)
517
- const storageProvider = await createStorageProvider();
518
-
519
- // Create models
520
- const reasoningModel = createKrutrimModel({
521
- endpoint: 'https://cloud.olakrutrim.com/v1/chat/completions',
522
- apiKey: 'your-api-key',
523
- model: 'gpt-oss-120b',
524
- type: 'reasoning',
525
- });
526
-
527
- // Create orchestrator
528
- const orchestrator = new ModelOrchestrator({ reasoningModel });
529
-
530
- // Initialize MCP
531
- const mcpManager = new MCPServerManager();
532
- await mcpManager.initialize({
533
- filesystem: {
534
- command: 'npx',
535
- args: ['-y', '@modelcontextprotocol/server-filesystem', process.cwd()],
536
- enabled: true,
537
- },
538
- });
286
+ **Code mode in the cloud:**
539
287
 
540
- // Initialize workspace
541
- const workspace = new WorkspaceManager(storageProvider);
542
- await workspace.initialize();
543
-
544
- // Initialize conversation manager
545
- const conversationManager = new ConversationManager(storageProvider);
546
-
547
- // Create three-agent system
548
- const agent = new DualAgent({
549
- orchestrator,
550
- mcpManager,
551
- workspace,
552
- conversationManager,
553
- maxSubtasks: 20, // Manager's subtask limit
554
- maxIterations: 10, // Worker's iteration limit per subtask
555
- });
556
-
557
- // Use agent
558
- const response = await agent.chat('Hello, Jiva!');
559
- console.log(response.content);
560
- console.log(`Plan: ${response.plan?.subtasks.join(', ')}`);
561
- console.log(`Tools used: ${response.toolsUsed.join(', ')}`);
562
-
563
- // Cleanup
564
- await agent.cleanup();
288
+ ```bash
289
+ gcloud run services update jiva \
290
+ --set-env-vars JIVA_CODE_MODE=true \
291
+ --region us-central1
565
292
  ```
566
293
 
567
- ### Cloud Mode (HTTP/WebSocket)
294
+ Full guide: [Cloud Run Deployment](docs/deployment/CLOUD_RUN_DEPLOYMENT.md)
568
295
 
569
- For cloud deployments, see the [HTTP interface documentation](docs/deployment/CLOUD_RUN_IMPLEMENTATION.md) and [example programs](examples/).
296
+ ---
570
297
 
571
- **Key difference:** Cloud mode uses `SessionManager` to handle multiple concurrent agent instances with per-tenant isolation.
572
- ## Development
298
+ ## Personas and Skills
573
299
 
574
- ### Build
300
+ Jiva supports persona-based skill management, compatible with Claude's Skills/Plugins format:
575
301
 
576
302
  ```bash
577
- npm run build
578
- ```
579
-
580
- ### Development Mode
581
-
582
- ```bash
583
- npm run dev
303
+ jiva persona list
304
+ jiva persona activate data-analyst
305
+ jiva persona create-skill my-skill --description "Custom capability" --author "Your Name"
584
306
  ```
585
307
 
586
- ### Type Checking
308
+ Skills bundle MCP servers, directives, and model behavior overrides into portable `.skill` files. See [Personas Guide](docs/guides/PERSONAS.md).
587
309
 
588
- ```bash
589
- npm run type-check
590
- ```
310
+ ---
591
311
 
592
312
  ## Programmatic Usage
593
313
 
594
- Jiva can also be used programmatically:
595
-
596
314
  ```typescript
597
- import {
598
- DualAgent,
599
- createKrutrimModel,
600
- ModelOrchestrator,
601
- MCPServerManager,
602
- WorkspaceManager,
603
- ConversationManager,
604
- } from 'jiva';
605
-
606
- // Create models
315
+ import { DualAgent, CodeAgent, createKrutrimModel, ModelOrchestrator,
316
+ MCPServerManager, WorkspaceManager, ConversationManager,
317
+ createStorageProvider } from 'jiva-core';
318
+
607
319
  const reasoningModel = createKrutrimModel({
608
- endpoint: 'https://cloud.olakrutrim.com/v1/chat/completions',
609
- apiKey: 'your-api-key',
610
- model: 'gpt-oss-120b',
320
+ endpoint: 'https://api.groq.com/openai/v1/chat/completions',
321
+ apiKey: process.env.API_KEY!,
322
+ model: 'openai/gpt-oss-20b',
611
323
  type: 'reasoning',
612
324
  });
613
-
614
- // Create orchestrator
615
325
  const orchestrator = new ModelOrchestrator({ reasoningModel });
326
+ const storageProvider = await createStorageProvider();
327
+ const workspace = new WorkspaceManager(storageProvider);
328
+ await workspace.initialize();
329
+ const conversationManager = new ConversationManager(storageProvider);
616
330
 
617
- // Initialize MCP
331
+ // General mode
618
332
  const mcpManager = new MCPServerManager();
619
333
  await mcpManager.initialize({
620
- filesystem: {
621
- command: 'npx',
622
- args: ['-y', '@modelcontextprotocol/server-filesystem', process.cwd()],
623
- enabled: true,
624
- },
625
- });
626
-
627
- // Initialize workspace
628
- const workspace = new WorkspaceManager({
629
- workspaceDir: process.cwd(),
630
- });
631
- await workspace.initialize();
632
-
633
- // Initialize conversation manager (optional)
634
- const conversationManager = new ConversationManager();
635
- await conversationManager.initialize();
636
-
637
- // Create dual-agent
638
- const agent = new DualAgent({
639
- orchestrator,
640
- mcpManager,
641
- workspace,
642
- conversationManager,
643
- maxSubtasks: 10,
334
+ filesystem: { command: 'npx', args: ['-y', '@modelcontextprotocol/server-filesystem', process.cwd()], enabled: true },
644
335
  });
645
-
646
- // Use agent
647
- const response = await agent.chat('Hello, Jiva!');
336
+ const agent = new DualAgent({ orchestrator, mcpManager, workspace, conversationManager });
337
+ const response = await agent.chat('What files are in this directory?');
648
338
  console.log(response.content);
649
- console.log(`Plan: ${response.plan?.subtasks.join(', ')}`);
650
- console.log(`Tools used: ${response.toolsUsed.join(', ')}`);
651
-
652
- // Cleanup
653
339
  await agent.cleanup();
654
- ```
655
-
656
- ## Troubleshooting
657
-
658
- ### Tool Calls Not Working
659
340
 
660
- The gpt-oss-120b model has known issues with tool calling reliability. Jiva implements several workarounds:
661
-
662
- 1. **Retry Logic**: Automatically retries malformed tool calls
663
- 2. **JSON Fixing**: Attempts to fix common JSON formatting issues
664
- 3. **Validation**: Validates tool calls against available tools
665
- 4. **Logging**: Enable debug mode to see detailed tool call information
666
-
667
- ```bash
668
- jiva chat --debug
341
+ // Code mode
342
+ const codeAgent = new CodeAgent({ orchestrator, workspace, conversationManager, maxIterations: 50, lspEnabled: true });
343
+ const codeResponse = await codeAgent.chat('Refactor the auth module to use async/await');
344
+ console.log(codeResponse.content);
345
+ await codeAgent.cleanup();
669
346
  ```
670
347
 
671
- ### MCP Server Connection Issues
348
+ Both `DualAgent` and `CodeAgent` implement the `IAgent` interface and are interchangeable in application code.
672
349
 
673
- Check server status:
350
+ ---
351
+
352
+ ## Development
674
353
 
675
354
  ```bash
676
- jiva chat
677
- # Then type: servers
355
+ npm run build # compile TypeScript
356
+ npm run dev # watch mode
357
+ npm run type-check # type-check without emit
678
358
  ```
679
359
 
680
- View logs:
360
+ ---
681
361
 
682
- ```bash
683
- jiva chat --debug
684
- ```
362
+ ## Documentation
685
363
 
686
- ## API Documentation
364
+ | Document | Description |
365
+ |----------|-------------|
366
+ | [Quick Start](docs/guides/QUICKSTART.md) | Get running in 30 seconds |
367
+ | [Configuration Guide](docs/guides/CONFIGURATION.md) | All config options and provider examples |
368
+ | [Code Mode Architecture](docs/architecture/CODE_MODE.md) | How code mode works internally |
369
+ | [Cloud Run Deployment](docs/deployment/CLOUD_RUN_DEPLOYMENT.md) | Production deployment guide |
370
+ | [Personas Guide](docs/guides/PERSONAS.md) | Skills and persona system |
371
+ | [Troubleshooting](docs/guides/TROUBLESHOOTING.md) | Common issues and fixes |
372
+ | [Release Notes](docs/release_notes/) | Version history |
687
373
 
688
- For detailed API documentation, see the TypeScript definitions in `src/`.
374
+ ---
689
375
 
690
376
  ## Contributing
691
377
 
692
- Contributions are welcome! Please ensure:
693
-
694
- 1. Code follows TypeScript best practices
695
- 2. All new features include proper error handling
696
- 3. Documentation is updated
378
+ Contributions are welcome. Please ensure new features include error handling and that documentation is updated. Open a PR against the `develop` branch.
697
379
 
698
380
  ## License
699
381
 
@@ -705,13 +387,3 @@ MIT
705
387
  - [Harmony Response Format](https://github.com/openai/harmony)
706
388
  - [Model Context Protocol](https://modelcontextprotocol.io/)
707
389
  - [Krutrim Cloud API](https://cloud.olakrutrim.com/)
708
-
709
- ## Sources
710
-
711
- This implementation is based on research from:
712
-
713
- - [OpenAI Harmony GitHub Repository](https://github.com/openai/harmony)
714
- - [MCP with OpenAI gpt-oss](https://github.com/Vaibhavs10/mcp-with-openai-gpt-oss)
715
- - [OpenAI Cookbook - Harmony Format](https://cookbook.openai.com/articles/openai-harmony)
716
- - [MCP Best Practices](https://modelcontextprotocol.info/docs/best-practices/)
717
- - [vLLM GPT-OSS Documentation](https://docs.vllm.ai/projects/recipes/en/latest/OpenAI/GPT-OSS.html)