Skip to content

Add AI chat agent support with Claude integration#103

Merged
rg4444 merged 2 commits into
mainfrom
claude/processgit-chatbot-integration-QWbzq
Feb 12, 2026
Merged

Add AI chat agent support with Claude integration#103
rg4444 merged 2 commits into
mainfrom
claude/processgit-chatbot-integration-QWbzq

Conversation

@rg4444
Copy link
Copy Markdown
Contributor

@rg4444 rg4444 commented Feb 12, 2026

Summary

This PR introduces a comprehensive AI chat agent system for ProcessGit repositories, enabling interactive AI-powered assistance through a chat interface. Users can now create agent.chat.yaml configuration files in their repositories to define custom chat agents powered by Claude (with extensibility for other LLM providers).

Key Features

  • Chat Panel UI Component: New Vue component (ChatPanel.vue) providing a modern chat interface with streaming responses, quick questions, conversation management, and usage tracking
  • Agent Configuration: YAML-based configuration system (agent.chat.yaml) supporting:
    • UI customization (name, icon, theme, welcome messages, quick questions)
    • LLM settings (model selection, temperature, max tokens, system prompts)
    • MCP tool integration (allow/deny lists for tool access control)
    • Conversation history persistence
    • Rate limiting and budget controls
    • Access control and visibility settings
  • Claude API Integration: Server-side streaming implementation with:
    • SSE (Server-Sent Events) for real-time response streaming
    • Tool call tracking and execution
    • Token usage and cost tracking
    • Multi-turn conversation support
  • Conversation Persistence: Git-based storage system for conversation history with:
    • Automatic indexing and retrieval
    • Per-user conversation management
    • Configurable retention policies
    • Buffered batch commits for efficiency
  • Rate Limiting & Budget Control: Per-user and per-repository controls with:
    • Minute and daily request limits
    • Monthly cost budgets
    • Configurable thresholds and alerts
  • File Tree Integration: Chat agents appear as clickable items in the repository file tree with custom icons and names

Technical Implementation

  • Backend: New modules/chat/ package with configuration loading, conversation management, Claude API integration, and history persistence
  • Router: New chat endpoints (/chat, /chat/agents, /chat/history) in routers/web/repo/chat.go
  • Frontend: Vue 3 chat component with TypeScript, streaming response handling, and real-time UI updates
  • Settings: New chat configuration section in modules/setting/chat.go
  • File Tree: Enhanced to detect and display chat agents with proper icons and metadata

Configuration Example

version: "1.0"
ui:
  name: "Repository Assistant"
  welcome_message: "Hello! How can I help?"
llm:
  provider: "anthropic"
  model: "claude-sonnet-4-5"
  api_key_ref: "ANTHROPIC_API_KEY"
mcp:
  use_repo_mcp: true
  allowed_tools: ["search", "get_entity"]

Validation

  • New feature addition (no BPMN/diff impact)
  • No schema changes required
  • Comprehensive test coverage included (config_test.go, history_test.go, integration_test.go)

Testing

  • Unit tests for configuration validation and parsing
  • Integration tests for Claude request building and multi-turn conversations
  • History management tests for conversation persistence
  • Manual testing of chat panel UI and streaming responses

Closes #[issue-number]

https://claude.ai/code/session_01WemnwGzTGVxxrRnRB6vX63

…andler

Implement the backend foundation for ProcessGit chatbot integration:

- modules/chat/types.go: Define all types for chat config (YAML), conversations,
  Claude API requests, SSE events
- modules/chat/config.go: YAML config parser with file discovery (agent.chat.yaml),
  validation, defaults, and API key resolution
- modules/chat/history.go: Git-based conversation storage with buffered writes,
  index management, and conversation lifecycle
- modules/setting/chat.go: Chat settings (enabled, rate limits, budget)
- routers/web/repo/chat.go: Chat API endpoint with SSE streaming, rate limiting,
  budget enforcement, and Claude API proxy with MCP tool support
- Route registration in web.go for POST /chat, GET /chat/agents, GET /chat/history

https://claude.ai/code/session_01WemnwGzTGVxxrRnRB6vX63
Frontend:
- ChatPanel.vue: Full chat UI with SSE streaming, quick questions,
  tool call indicators, typing animation, and status bar
- ViewFileTreeItem.vue: Detect chat agent files, show robot icon and
  friendly name, click opens chat panel instead of file viewer
- ViewFileTreeStore.ts: Add chatAgentName field, openChatPanel method
- repo-view-file-tree.ts: Mount/unmount ChatPanel on open-chat-agent event

Backend:
- tree.go: Annotate TreeViewNode with chatAgentName when file matches
  agent.chat.yaml pattern and config is valid

Tests:
- integration_test.go: Claude API request format, tool allow/deny lists,
  multi-turn conversations, SSE events, JSON round-trip, cost estimation

Docs:
- docs/chat-agents.md: Complete reference for agent.chat.yaml format,
  API endpoints, configuration, and troubleshooting

https://claude.ai/code/session_01WemnwGzTGVxxrRnRB6vX63
@rg4444 rg4444 merged commit 86592f2 into main Feb 12, 2026
10 of 23 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4c24d4947

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread routers/web/repo/chat.go
Comment on lines +110 to +113
userID := "anonymous"
userName := "Anonymous"
if ctx.Doer != nil {
userID = fmt.Sprintf("%d", ctx.Doer.ID)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Enforce access.visibility before accepting anonymous chat requests

cfg.Access.Visibility is never enforced here: the handler assigns unauthenticated callers the synthetic user anonymous and continues normally. Because the /chat routes are registered with optSignInIgnoreCsrf in routers/web/web.go, public repositories can be queried without login even when the config default is visibility: authenticated, allowing anonymous users to consume model budget and bypass the intended access policy.

Useful? React with 👍 / 👎.

Comment thread routers/web/repo/chat.go
ctx.Resp.Header().Set("Connection", "keep-alive")
ctx.Resp.Header().Set("X-Accel-Buffering", "no")

assistantContent, toolCalls, usage, err := streamClaudeResponse(ctx.Resp, apiKey, claudeReq)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Dispatch chat requests by configured LLM provider

This code always sends requests through the Claude/Anthropic path, regardless of cfg.LLM.Provider. Since config validation explicitly allows openai and ollama, those agents will still be serialized as Claude payloads and posted with Anthropic headers, causing runtime failures for non-Anthropic providers even though their configs are accepted.

Useful? React with 👍 / 👎.

Comment thread routers/web/repo/chat.go
Comment on lines +196 to +198
if cfg.History.Enabled {
buf := chat.GetBuffer(ctx.Repo.Repository.ID)
buf.BufferConversation(conv)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Flush buffered conversations to persistent history storage

When history.enabled is set, conversations are only placed into an in-memory buffer; there is no production call site that drains/flushed this buffer to git (repo-wide search shows DrainConversations used only in tests). That means conversation history is never persisted and is lost on restart, so the history feature does not function as documented.

Useful? React with 👍 / 👎.

// Create mount point
chatMountEl = document.createElement('div');
chatMountEl.className = 'chat-panel-container';
repoViewContent.innerHTML = '';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve repo content when mounting the chat panel

Opening a chat agent clears the entire .repo-view-content container with innerHTML = '', but closing chat only unmounts/removes the chat node and never restores what was removed. In practice, after a user opens and closes the panel, the repository content area stays blank until they reload or navigate away.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants