jiva-core 0.2.3 → 0.3.2

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 (152) hide show
  1. package/.dockerignore +53 -0
  2. package/.gcloudignore +49 -0
  3. package/CONTRIBUTING.md +92 -0
  4. package/Dockerfile +63 -0
  5. package/README.md +250 -88
  6. package/cloud-run-deploy.yaml +135 -0
  7. package/cloud-run.yaml +135 -0
  8. package/cloud-run.yaml.template +143 -0
  9. package/deploy.sh +107 -0
  10. package/dist/core/agent-spawner.d.ts +89 -0
  11. package/dist/core/agent-spawner.d.ts.map +1 -0
  12. package/dist/core/agent-spawner.js +208 -0
  13. package/dist/core/agent-spawner.js.map +1 -0
  14. package/dist/core/agent.js +1 -1
  15. package/dist/core/agent.js.map +1 -1
  16. package/dist/core/client-agent.d.ts +103 -0
  17. package/dist/core/client-agent.d.ts.map +1 -0
  18. package/dist/core/client-agent.js +659 -0
  19. package/dist/core/client-agent.js.map +1 -0
  20. package/dist/core/config.d.ts +59 -10
  21. package/dist/core/config.d.ts.map +1 -1
  22. package/dist/core/config.js +19 -2
  23. package/dist/core/config.js.map +1 -1
  24. package/dist/core/conversation-manager.d.ts +10 -18
  25. package/dist/core/conversation-manager.d.ts.map +1 -1
  26. package/dist/core/conversation-manager.js +31 -63
  27. package/dist/core/conversation-manager.js.map +1 -1
  28. package/dist/core/dual-agent.d.ts +22 -3
  29. package/dist/core/dual-agent.d.ts.map +1 -1
  30. package/dist/core/dual-agent.js +86 -10
  31. package/dist/core/dual-agent.js.map +1 -1
  32. package/dist/core/manager-agent.d.ts +16 -1
  33. package/dist/core/manager-agent.d.ts.map +1 -1
  34. package/dist/core/manager-agent.js +127 -44
  35. package/dist/core/manager-agent.js.map +1 -1
  36. package/dist/core/worker-agent.d.ts +9 -1
  37. package/dist/core/worker-agent.d.ts.map +1 -1
  38. package/dist/core/worker-agent.js +169 -14
  39. package/dist/core/worker-agent.js.map +1 -1
  40. package/dist/core/workspace.d.ts +5 -0
  41. package/dist/core/workspace.d.ts.map +1 -1
  42. package/dist/core/workspace.js +47 -7
  43. package/dist/core/workspace.js.map +1 -1
  44. package/dist/index.d.ts +3 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +4 -0
  47. package/dist/index.js.map +1 -1
  48. package/dist/interfaces/cli/index.js +349 -42
  49. package/dist/interfaces/cli/index.js.map +1 -1
  50. package/dist/interfaces/http/index.d.ts +22 -0
  51. package/dist/interfaces/http/index.d.ts.map +1 -0
  52. package/dist/interfaces/http/index.js +135 -0
  53. package/dist/interfaces/http/index.js.map +1 -0
  54. package/dist/interfaces/http/middleware/auth.d.ts +32 -0
  55. package/dist/interfaces/http/middleware/auth.d.ts.map +1 -0
  56. package/dist/interfaces/http/middleware/auth.js +176 -0
  57. package/dist/interfaces/http/middleware/auth.js.map +1 -0
  58. package/dist/interfaces/http/routes/chat.d.ts +7 -0
  59. package/dist/interfaces/http/routes/chat.d.ts.map +1 -0
  60. package/dist/interfaces/http/routes/chat.js +144 -0
  61. package/dist/interfaces/http/routes/chat.js.map +1 -0
  62. package/dist/interfaces/http/routes/health.d.ts +6 -0
  63. package/dist/interfaces/http/routes/health.d.ts.map +1 -0
  64. package/dist/interfaces/http/routes/health.js +25 -0
  65. package/dist/interfaces/http/routes/health.js.map +1 -0
  66. package/dist/interfaces/http/routes/session.d.ts +7 -0
  67. package/dist/interfaces/http/routes/session.d.ts.map +1 -0
  68. package/dist/interfaces/http/routes/session.js +114 -0
  69. package/dist/interfaces/http/routes/session.js.map +1 -0
  70. package/dist/interfaces/http/session-manager.d.ts +76 -0
  71. package/dist/interfaces/http/session-manager.d.ts.map +1 -0
  72. package/dist/interfaces/http/session-manager.js +350 -0
  73. package/dist/interfaces/http/session-manager.js.map +1 -0
  74. package/dist/interfaces/http/websocket-handler.d.ts +18 -0
  75. package/dist/interfaces/http/websocket-handler.d.ts.map +1 -0
  76. package/dist/interfaces/http/websocket-handler.js +146 -0
  77. package/dist/interfaces/http/websocket-handler.js.map +1 -0
  78. package/dist/mcp/client.d.ts +11 -2
  79. package/dist/mcp/client.d.ts.map +1 -1
  80. package/dist/mcp/client.js +44 -19
  81. package/dist/mcp/client.js.map +1 -1
  82. package/dist/mcp/server-manager.d.ts +1 -1
  83. package/dist/mcp/server-manager.d.ts.map +1 -1
  84. package/dist/mcp/server-manager.js +12 -2
  85. package/dist/mcp/server-manager.js.map +1 -1
  86. package/dist/models/krutrim.js +1 -1
  87. package/dist/models/krutrim.js.map +1 -1
  88. package/dist/personas/index.d.ts +13 -0
  89. package/dist/personas/index.d.ts.map +1 -0
  90. package/dist/personas/index.js +13 -0
  91. package/dist/personas/index.js.map +1 -0
  92. package/dist/personas/persona-loader.d.ts +30 -0
  93. package/dist/personas/persona-loader.d.ts.map +1 -0
  94. package/dist/personas/persona-loader.js +246 -0
  95. package/dist/personas/persona-loader.js.map +1 -0
  96. package/dist/personas/persona-manager.d.ts +93 -0
  97. package/dist/personas/persona-manager.d.ts.map +1 -0
  98. package/dist/personas/persona-manager.js +268 -0
  99. package/dist/personas/persona-manager.js.map +1 -0
  100. package/dist/personas/skill-loader.d.ts +35 -0
  101. package/dist/personas/skill-loader.d.ts.map +1 -0
  102. package/dist/personas/skill-loader.js +144 -0
  103. package/dist/personas/skill-loader.js.map +1 -0
  104. package/dist/personas/skill-packager.d.ts +25 -0
  105. package/dist/personas/skill-packager.d.ts.map +1 -0
  106. package/dist/personas/skill-packager.js +233 -0
  107. package/dist/personas/skill-packager.js.map +1 -0
  108. package/dist/personas/types.d.ts +134 -0
  109. package/dist/personas/types.d.ts.map +1 -0
  110. package/dist/personas/types.js +7 -0
  111. package/dist/personas/types.js.map +1 -0
  112. package/dist/personas/validator.d.ts +22 -0
  113. package/dist/personas/validator.d.ts.map +1 -0
  114. package/dist/personas/validator.js +144 -0
  115. package/dist/personas/validator.js.map +1 -0
  116. package/dist/storage/factory.d.ts +51 -0
  117. package/dist/storage/factory.d.ts.map +1 -0
  118. package/dist/storage/factory.js +154 -0
  119. package/dist/storage/factory.js.map +1 -0
  120. package/dist/storage/gcp-bucket-provider.d.ts +60 -0
  121. package/dist/storage/gcp-bucket-provider.d.ts.map +1 -0
  122. package/dist/storage/gcp-bucket-provider.js +292 -0
  123. package/dist/storage/gcp-bucket-provider.js.map +1 -0
  124. package/dist/storage/index.d.ts +33 -0
  125. package/dist/storage/index.d.ts.map +1 -0
  126. package/dist/storage/index.js +37 -0
  127. package/dist/storage/index.js.map +1 -0
  128. package/dist/storage/local-provider.d.ts +37 -0
  129. package/dist/storage/local-provider.d.ts.map +1 -0
  130. package/dist/storage/local-provider.js +228 -0
  131. package/dist/storage/local-provider.js.map +1 -0
  132. package/dist/storage/provider.d.ts +142 -0
  133. package/dist/storage/provider.d.ts.map +1 -0
  134. package/dist/storage/provider.js +136 -0
  135. package/dist/storage/provider.js.map +1 -0
  136. package/dist/storage/types.d.ts +78 -0
  137. package/dist/storage/types.d.ts.map +1 -0
  138. package/dist/storage/types.js +14 -0
  139. package/dist/storage/types.js.map +1 -0
  140. package/dist/utils/logger.d.ts +19 -0
  141. package/dist/utils/logger.d.ts.map +1 -1
  142. package/dist/utils/logger.js +49 -1
  143. package/dist/utils/logger.js.map +1 -1
  144. package/dist/utils/orchestration-logger.d.ts +27 -3
  145. package/dist/utils/orchestration-logger.d.ts.map +1 -1
  146. package/dist/utils/orchestration-logger.js +110 -6
  147. package/dist/utils/orchestration-logger.js.map +1 -1
  148. package/package.json +30 -2
  149. package/.fluen/cache/state.json +0 -7
  150. package/actions/action_registry.py +0 -75
  151. package/actions/python_coder.py +0 -470
  152. package/api/main.py +0 -269
package/.dockerignore ADDED
@@ -0,0 +1,53 @@
1
+ # Node modules (will be reinstalled)
2
+ node_modules/
3
+
4
+ # Build outputs (will be rebuilt)
5
+ dist/
6
+
7
+ # Development files
8
+ *.log
9
+ npm-debug.log*
10
+ yarn-debug.log*
11
+ yarn-error.log*
12
+ .npm
13
+ .eslintcache
14
+
15
+ # IDE
16
+ .vscode/
17
+ .idea/
18
+ *.swp
19
+ *.swo
20
+ *~
21
+ .DS_Store
22
+
23
+ # Git
24
+ .git/
25
+ .gitignore
26
+ .gitattributes
27
+
28
+ # Documentation
29
+ *.md
30
+ !README.md
31
+ docs/
32
+ examples/
33
+
34
+ # Tests
35
+ test/
36
+ tests/
37
+ *.test.ts
38
+ *.spec.ts
39
+
40
+ # CI/CD
41
+ .github/
42
+ .gitlab-ci.yml
43
+ .travis.yml
44
+
45
+ # Local development
46
+ .env
47
+ .env.local
48
+ .env.*.local
49
+
50
+ # Temporary files
51
+ tmp/
52
+ temp/
53
+ *.tmp
package/.gcloudignore ADDED
@@ -0,0 +1,49 @@
1
+ # Google Cloud Build ignore patterns
2
+ # Files not needed in Cloud Build/Container Registry
3
+
4
+ # Node modules (will be installed in container)
5
+ node_modules/
6
+
7
+ # Development and docs
8
+ docs/
9
+ examples/
10
+ *.md
11
+ !README.md
12
+
13
+ # Git
14
+ .git/
15
+ .gitignore
16
+ .gitattributes
17
+
18
+ # Editor
19
+ .vscode/
20
+ .idea/
21
+ *.swp
22
+ *.swo
23
+
24
+ # OS
25
+ .DS_Store
26
+ Thumbs.db
27
+
28
+ # Logs
29
+ *.log
30
+
31
+ # Build artifacts (will be rebuilt)
32
+ dist/
33
+ *.tsbuildinfo
34
+
35
+ # Test files
36
+ test/
37
+ tests/
38
+ *.test.ts
39
+ *.test.js
40
+ *.spec.ts
41
+ *.spec.js
42
+
43
+ # npm package files
44
+ .npmignore
45
+ .npmrc
46
+
47
+ # Scripts (except deploy.sh which is needed)
48
+ setup.sh
49
+ fix-filesystem-config.js
@@ -0,0 +1,92 @@
1
+ # Contributing to Jiva
2
+
3
+ Thank you for your interest in contributing to Jiva! This document provides guidelines for contributing to the project.
4
+
5
+ ## Code of Conduct
6
+
7
+ Be respectful and constructive in your interactions with other contributors.
8
+
9
+ ## Getting Started
10
+
11
+ 1. **Fork the repository** on GitHub
12
+ 2. **Clone your fork:**
13
+ ```bash
14
+ git clone https://github.com/YOUR_USERNAME/Jiva.git
15
+ cd Jiva
16
+ ```
17
+ 3. **Install dependencies:**
18
+ ```bash
19
+ npm install
20
+ ```
21
+ 4. **Build the project:**
22
+ ```bash
23
+ npm run build
24
+ ```
25
+
26
+ ## Development Workflow
27
+
28
+ See [docs/guides/DEV_WORKFLOW.md](docs/guides/DEV_WORKFLOW.md) for detailed development instructions.
29
+
30
+ ### Quick Commands
31
+
32
+ ```bash
33
+ npm run build # Compile TypeScript
34
+ npm run dev # Watch mode for development
35
+ npm run type-check # Check TypeScript types
36
+ npm test # Run tests (when available)
37
+ ```
38
+
39
+ ## Making Changes
40
+
41
+ 1. **Create a feature branch:**
42
+ ```bash
43
+ git checkout -b feature/your-feature-name
44
+ ```
45
+
46
+ 2. **Make your changes** following the coding standards
47
+
48
+ 3. **Test your changes:**
49
+ ```bash
50
+ npm run build
51
+ npm link # Test CLI globally
52
+ jiva chat # Verify functionality
53
+ ```
54
+
55
+ 4. **Commit with clear messages:**
56
+ ```bash
57
+ git commit -m "feat: add new feature X"
58
+ ```
59
+
60
+ ## Coding Standards
61
+
62
+ - **TypeScript**: All code must be in TypeScript
63
+ - **Formatting**: Follow existing code style
64
+ - **Error Handling**: All functions should handle errors gracefully
65
+ - **Logging**: Use the logger utility for consistent logging
66
+ - **Documentation**: Update docs for new features
67
+
68
+ ## Pull Request Process
69
+
70
+ 1. **Update documentation** for any changed functionality
71
+ 2. **Update README.md** if adding new features
72
+ 3. **Add release notes** in `docs/release_notes/` if applicable
73
+ 4. **Create pull request** with clear description of changes
74
+ 5. **Link related issues** in the PR description
75
+
76
+ ## Areas for Contribution
77
+
78
+ - Bug fixes
79
+ - New MCP server integrations
80
+ - Documentation improvements
81
+ - Performance optimizations
82
+ - Test coverage
83
+ - Storage provider implementations (S3, Redis, etc.)
84
+ - UI/UX improvements for CLI interface
85
+
86
+ ## Questions?
87
+
88
+ Open an issue on GitHub for any questions about contributing.
89
+
90
+ ## License
91
+
92
+ By contributing to Jiva, you agree that your contributions will be licensed under the MIT License.
package/Dockerfile ADDED
@@ -0,0 +1,63 @@
1
+ # Multi-stage build for Jiva Cloud Run deployment
2
+ # Stage 1: Build
3
+ FROM node:20-alpine AS builder
4
+
5
+ WORKDIR /app
6
+
7
+ # Copy package files
8
+ COPY package*.json ./
9
+ COPY tsconfig.json ./
10
+
11
+ # Install dependencies (including dev dependencies for build)
12
+ RUN npm ci
13
+
14
+ # Copy source code
15
+ COPY src ./src
16
+
17
+ # Build TypeScript
18
+ RUN npm run build
19
+
20
+ # Stage 2: Production
21
+ FROM node:20-alpine
22
+
23
+ WORKDIR /app
24
+
25
+ # Install dumb-init for proper signal handling
26
+ RUN apk add --no-cache dumb-init
27
+
28
+ # Copy package files
29
+ COPY package*.json ./
30
+
31
+ # Install production dependencies only
32
+ RUN npm ci --omit=dev && npm cache clean --force
33
+
34
+ # Copy built application from builder
35
+ COPY --from=builder /app/dist ./dist
36
+
37
+ # Create non-root user
38
+ RUN addgroup -g 1001 -S nodejs && \
39
+ adduser -S nodejs -u 1001 && \
40
+ chown -R nodejs:nodejs /app
41
+
42
+ USER nodejs
43
+
44
+ # Environment variables (overrideable)
45
+ ENV NODE_ENV=production \
46
+ PORT=8080 \
47
+ LOG_LEVEL=info \
48
+ JIVA_STORAGE_PROVIDER=gcp \
49
+ MAX_CONCURRENT_SESSIONS=100 \
50
+ SESSION_IDLE_TIMEOUT_MS=1800000
51
+
52
+ # Expose port
53
+ EXPOSE 8080
54
+
55
+ # Health check
56
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
57
+ CMD node -e "require('http').get('http://localhost:8080/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
58
+
59
+ # Use dumb-init to handle signals properly
60
+ ENTRYPOINT ["dumb-init", "--"]
61
+
62
+ # Start HTTP server
63
+ CMD ["node", "dist/interfaces/http/index.js"]
package/README.md CHANGED
@@ -2,15 +2,16 @@
2
2
 
3
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)
4
4
 
5
- Jiva is a powerful autonomous AI agent powered by gpt-oss-120b with full MCP (Model Context Protocol) support. It's designed to be highly goal-oriented, autonomous, and extensible for various use cases.
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
6
 
7
7
  ## Quick Links
8
8
 
9
- - **[Quick Start Guide](docs/QUICKSTART.md)** - Get up and running in 30 seconds
10
- - **[Configuration Guide](docs/CONFIGURATION.md)** - Detailed configuration and provider setup
11
- - **[New Features Guide](docs/NEW_FEATURES.md)** - Latest improvements and features
12
- - **[Build Instructions](docs/BUILD.md)** - Detailed setup and development workflow
13
- - **[Troubleshooting](docs/TROUBLESHOOTING.md)** - Common issues and solutions
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
14
15
 
15
16
  ## Demo
16
17
 
@@ -19,26 +20,85 @@ Jiva is a powerful autonomous AI agent powered by gpt-oss-120b with full MCP (Mo
19
20
  ## Features
20
21
 
21
22
  ### Core Capabilities
22
- - **Dual-Agent Architecture**: Manager + Worker pattern for reliable task execution and planning
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
23
28
  - **Provider Agnostic**: Works with Krutrim, Groq, OpenAI, Ollama, and any OpenAI-compatible API
24
- - **Three-Phase Execution**: Planning → Execution → Synthesis for structured task completion
25
29
  - **MCP Integration**: Seamless integration with Model Context Protocol servers for extensible tooling
26
30
  - **Smart Conversations**: Auto-save, restore, and AI-generated titles for all conversations
27
- - **Pretty Markdown**: Beautiful terminal output with syntax highlighting
28
31
  - **Directive-Based**: Orient agent behavior with custom `jiva-directive.md` files
29
- - **Multi-Modal Support**: Optional image understanding via Llama-4-Maverick-17B
30
- - **Auto-Condensing**: Intelligent conversation history management to prevent token overload
32
+ - **Storage Abstraction**: Local filesystem or cloud storage (GCS, future: S3, Redis)
31
33
 
32
- ### Advanced Features (v0.2.1)
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
33
94
  - **Dual-Agent System**: Separate Manager and Worker agents for better task focus and reliability
34
95
  - **Chain-of-Thought Logging**: Transparent reasoning at INFO level with clean ASCII formatting
35
96
  - **Robust Error Recovery**: Automatic retry with error feedback for API and tool failures
36
97
  - **Workspace-Aware Operations**: Smart path resolution for file operations
37
98
  - **Slash Commands**: Use `/help`, `/load`, `/save`, `/list` for easy conversation management
38
99
  - **Smart Tool Format Detection**: Auto-detects Harmony vs Standard OpenAI tool calling format
39
- - **Extensible Architecture**: Designed to expand from CLI to desktop or web applications
40
100
 
41
- See [NEW_FEATURES.md](docs/NEW_FEATURES.md) for detailed information.
101
+ See [release notes](docs/release_notes/) for detailed version history.
42
102
 
43
103
  ## Installation
44
104
 
@@ -58,21 +118,15 @@ jiva setup
58
118
 
59
119
  ```bash
60
120
  git clone https://github.com/KarmaloopAI/Jiva.git
61
- cd jiva
62
- npm install
63
- npm run build
64
- npm link # For global CLI access
65
- ```
121
+ cd jCLI Mode (Local Development)
66
122
 
67
- ## Quick Start
68
-
69
- ### 1. Install Jiva
123
+ #### 1. Install Jiva
70
124
 
71
125
  ```bash
72
126
  npm install -g jiva-core
73
127
  ```
74
128
 
75
- ### 2. First-Time Setup
129
+ #### 2. First-Time Setup
76
130
 
77
131
  Run the interactive setup wizard:
78
132
 
@@ -86,7 +140,7 @@ You'll be prompted for:
86
140
  - Optional multimodal model (Llama-4-Maverick-17B)
87
141
  - MCP server configuration
88
142
 
89
- ### 3. Start Chatting
143
+ #### 3. Start Chatting
90
144
 
91
145
  Launch interactive mode:
92
146
 
@@ -104,8 +158,69 @@ You: /save # Save this conversation
104
158
  You: /list # View all saved conversations
105
159
  ```
106
160
 
161
+ ### Cloud Run Mode (Production)
162
+
163
+ Deploy Jiva as an auto-scaling HTTP/WebSocket service:
164
+
165
+ #### 1. Prerequisites
166
+
167
+ - Google Cloud account with billing enabled
168
+ - `gcloud` CLI installed and configured
169
+ - Docker installed (for local testing)
170
+
171
+ #### 2. One-Command Deployment
172
+
173
+ ```bash
174
+ git clone https://github.com/KarmaloopAI/Jiva.git
175
+ cd jiva
176
+ ./deploy.sh YOUR_PROJECT_ID us-central1
177
+ ```
178
+
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
185
+
186
+ #### 3. Test Deployment
187
+
188
+ ```bash
189
+ SERVICE_URL=$(gcloud run services describe jiva --region=us-central1 --format='value(status.url)')
190
+
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
+ ```
200
+
201
+ **Full deployment guide:** [Cloud Run Deployment](docs/deployment/CLOUD_RUN_DEPLOYMENT.md)ry these commands:**
202
+ ```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
209
+ ```
210
+
107
211
  ### 4. Advanced Usage
108
212
 
213
+ **View current configuration:**
214
+ ```bash
215
+ jiva config --show
216
+ ```
217
+
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
+ ```
223
+
109
224
  **Custom workspace and directive:**
110
225
  ```bash
111
226
  jiva chat --workspace /path/to/project --directive ./project-directive.md
@@ -216,7 +331,7 @@ Provides comprehensive file operations across user directories (subject to OS pe
216
331
  - **Package:** `@modelcontextprotocol/server-filesystem`
217
332
  - **Access:** `/Users` (macOS/Linux) or `C:\Users` (Windows)
218
333
  - **Tools:** read_file, write_file, list_directory, create_directory, and more
219
- - **Details:** See [FILESYSTEM_ACCESS.md](docs/FILESYSTEM_ACCESS.md)
334
+ - **Details:** See [FILESYSTEM_ACCESS.md](docs/architecture/FILESYSTEM_ACCESS.md)
220
335
 
221
336
  ### Recommended Additional Servers
222
337
 
@@ -320,93 +435,140 @@ Edit your config file at `~/.config/jiva-nodejs/config.json` (Linux) or `~/Libra
320
435
  #### Programmatically
321
436
 
322
437
  ```typescript
323
- import { configManager } from 'jiva-core';
438
+ ### Three-Agent System (v0.3.1)
324
439
 
325
- configManager.addMCPServer('playwright', {
326
- command: 'npx',
327
- args: ['@playwright/mcp@latest'],
328
- enabled: true,
329
- });
330
- ```
331
-
332
- ### Checking MCP Server Status
333
-
334
- ```bash
335
- jiva chat
336
- # Type: /servers
337
- ```
440
+ Jiva uses a three-agent architecture for intelligent task execution:
338
441
 
339
- You'll see:
340
442
  ```
341
- MCP Servers:
342
- ✓ filesystem: 12 tools
343
- ✓ playwright: 8 tools
344
- desktop-commander: 6 tools
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
345
458
  ```
346
459
 
347
- **Troubleshooting MCP Issues:** See [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md#mcp-server-issues)
348
-
349
- ## CLI Commands
350
-
351
- ### Interactive Mode Commands
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)
352
463
 
353
- While in chat mode, you can use these commands (prefix with `/`):
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
354
468
 
355
- - `/help` - Show available commands
356
- - `/exit` / `/quit` - Exit the session
357
- - `/reset` - Reset conversation history
358
- - `/history` - Show conversation history
359
- - `/tools` - List available MCP tools
360
- - `/servers` - Show MCP server status
361
- - `/save` - Save current conversation ✨ NEW
362
- - `/load` - Load a saved conversation ✨ NEW
363
- - `/list` - List all saved conversations ✨ NEW
364
-
365
- ## Architecture
366
-
367
- Jiva is designed with extensibility in mind:
469
+ ### Project Structure
368
470
 
369
471
  ```
370
472
  jiva/
371
473
  ├── src/
372
- │ ├── core/ # Core agent logic
373
- │ ├── models/ # Model integrations and Harmony format
374
- │ ├── mcp/ # MCP client and server management
375
- │ ├── interfaces/ # CLI, Electron, Web interfaces
376
- │ └── utils/ # Utilities and helpers
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
377
488
  ```
378
489
 
379
490
  ### Key Components
380
491
 
381
- 1. **DualAgent**: Main orchestrator coordinating Manager and Worker agents (v0.2.1+)
492
+ 1. **DualAgent**: Main orchestrator coordinating Manager, Worker, and Client agents
382
493
  2. **ManagerAgent**: High-level planning, task breakdown, and result synthesis
383
494
  3. **WorkerAgent**: Focused tool execution and information gathering
384
- 4. **ModelOrchestrator**: Manages multi-model coordination (reasoning + multimodal)
385
- 5. **MCPServerManager**: Handles MCP server lifecycle and tool discovery
386
- 6. **WorkspaceManager**: Manages workspace directory and directive files
387
- 7. **Harmony Format Handler**: Implements gpt-oss-120b's required response format
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
+
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
+ });
539
+
540
+ // Initialize workspace
541
+ const workspace = new WorkspaceManager(storageProvider);
542
+ await workspace.initialize();
388
543
 
389
- **Legacy:** JivaAgent (single-agent) remains available for compatibility
544
+ // Initialize conversation manager
545
+ const conversationManager = new ConversationManager(storageProvider);
390
546
 
391
- ## Working with gpt-oss-120b
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
+ });
392
556
 
393
- The gpt-oss-120b model requires the Harmony response format. Jiva handles this automatically with:
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(', ')}`);
394
562
 
395
- ### Tool Call Parsing
396
- - Robust parsing of `<|call|>function_name({"param": "value"})<|return|>` format
397
- - Automatic JSON fixing for common formatting issues
398
- - Validation against available tools
563
+ // Cleanup
564
+ await agent.cleanup();
565
+ ```
399
566
 
400
- ### Multi-Channel Output
401
- - Analysis channel: Chain-of-thought reasoning
402
- - Final channel: User-facing responses
403
- - Tool calling: Structured function calls
567
+ ### Cloud Mode (HTTP/WebSocket)
404
568
 
405
- ### Error Handling
406
- - Retry logic for malformed tool calls
407
- - Graceful degradation when tools fail
408
- - Detailed logging for debugging
569
+ For cloud deployments, see the [HTTP interface documentation](docs/deployment/CLOUD_RUN_IMPLEMENTATION.md) and [example programs](examples/).
409
570
 
571
+ **Key difference:** Cloud mode uses `SessionManager` to handle multiple concurrent agent instances with per-tenant isolation.
410
572
  ## Development
411
573
 
412
574
  ### Build