Skip to content

DowlingIT/redmine_project_agent

Repository files navigation

Redmine AI Project Agent

This is a Next.js app with AI integration for Redmine project management and Git repository analysis. It uses Anthropic's Claude AI with the Model Context Protocol (MCP) for intelligent project assistance.

Features

AI-Powered Chat - Conversational interface with Claude AI ✅ Persistent Conversations - Session management with full history ✅ Permanent Context - Project-specific context loaded into every chat ✅ PII Protection - Automatic detection and redaction of sensitive information ✅ Redmine Integration - Access project tickets and status ✅ Git Analysis - Analyze commits and repository activity ✅ MCP Tools - Extensible tool system for custom integrations

Quick Start

1. Install Dependencies

npm install

2. Configure Environment

Create a .env file with:

ANTHROPIC_API_KEY=your_key_here
REDMINE_API_URL=https://your-redmine-instance.com/
REDMINE_API_KEY=your_redmine_key
GIT_DIRECTORY_PATH=C:\path\to\your\repo

3. Run Development Server

npm run dev

Open http://localhost:3000 with your browser.

4. Test the Chat System

# Test Anthropic connection
npx tsx scripts/test-anthropic.ts

# Test chat system
npx tsx scripts/test-chat-system.ts

Usage

Start a Chat

curl -X POST http://localhost:3000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "What are my open issues?"}'

Continue a Conversation

curl -X POST http://localhost:3000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Show me issue #123", "sessionId": "YOUR-SESSION-ID"}'

List All Sessions

curl http://localhost:3000/api/chat

Architecture Overview

┌─────────────────┐
│   Your App      │
│  (Next.js UI)   │
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│  API Routes     │
│  /api/chat      │
└────────┬────────┘
         │
         ▼
┌─────────────────┐      ┌──────────────────┐
│   MCP Client    │◄────►│  Anthropic API   │
│                 │      │  (Claude AI)     │
└────────┬────────┘      └──────────────────┘
         │
         ▼
┌─────────────────┐
│   MCP Server    │
│  - Redmine API  │
│  - Git Tools    │
└─────────────────┘

API Endpoints

Endpoint Method Description
/api/chat POST Send a message (creates or continues session)
/api/chat GET List all sessions or get specific session
/api/chat DELETE Delete a session
/api/chat/new POST Create a new session with metadata
/api/context GET View permanent context
/api/context POST Reload context files

Documentation

Key Features Explained

Permanent Context

Context files in contexts/ are automatically loaded into every conversation:

  • system-prompt.md - Defines AI personality and capabilities
  • project-context.md - Your project-specific information

Edit these files to customize the AI's behavior and knowledge.

Session Management

Conversations are automatically saved to .chat-sessions/:

  • Full message history preserved
  • Searchable by title and tags
  • Can be resumed anytime
  • Local storage (not in Git)

Model Context Protocol (MCP)

Extensible tool system for:

  • Redmine API access
  • Git repository analysis
  • Custom integrations

Development

# Start dev server with hot reload
npm run dev

# Run linting
npm run lint

# Build for production
npm run build

# Start production server
npm start

# Run MCP server standalone
npm run mcp:server

Customization

Update AI Behavior

Edit contexts/system-prompt.md to change how the AI responds.

Add Project Context

Edit contexts/project-context.md with your project details.

Configure Model

Edit config/anthropic.ts to change:

  • Model version
  • Temperature
  • Max tokens
  • Other parameters

Add Custom Tools

Extend lib/mcp-server.ts to add new tools for Redmine, Git, or other integrations.

Troubleshooting

Chat not working

  1. Verify ANTHROPIC_API_KEY in .env
  2. Run npx tsx scripts/test-anthropic.ts
  3. Check console for errors

Sessions not persisting

  1. Check .chat-sessions/ directory exists
  2. Verify file permissions
  3. Check available disk space

Context not loading

  1. Verify files exist in contexts/
  2. Call POST /api/context to reload
  3. Check server logs

Security Note

⚠️ This application is designed for LOCAL DEVELOPMENT ONLY

  • No authentication on API routes
  • Sessions stored in plain text
  • API keys in environment variables

Do not deploy to production without proper security measures.

Contributing

This is a personal project. Feel free to fork and modify for your needs.

License

This project is for personal use. Modify as needed.


Learn More

About

redmine AI chat

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages