Skip to main content

Terminal-based AI interaction tracker and code analyzer for traceability in Software Engineering.

Project description

AI-Dev-Tracker

AI-Assisted Software Development Traceability Tool


๐Ÿ“Œ Project Overview

AI-Dev-Tracker is a CLI-based tool designed to track, analyze, and measure the impact of AI-assisted development in software projects.

As developers increasingly rely on AI tools (e.g., ChatGPT, Claude), there is no systematic way to:

  • Track prompt history
  • Link AI responses to code changes
  • Measure AI contribution to final software
  • Identify areas where developers struggled
  • Maintain structured, goal-driven development sessions

This tool provides a structured solution to record, analyze, and report AI-assisted development activity.


๐ŸŽฏ Problem Statement

Modern software development increasingly integrates AI-generated code. However, there is no standardized mechanism to:

  • Maintain prompt history
  • Link AI interactions to version control
  • Identify which parts of code were AI-generated
  • Analyze developer struggle through AI usage patterns
  • Ensure session coherence when developers ask unrelated questions mid-session

AI-Dev-Tracker addresses this by creating a Git-linked AI interaction logging and analysis system with structured session flow enforcement.


๐Ÿš€ Key Features

  • Multi-LLM support โ€” works with any OpenAI-compatible provider (Gemini, OpenAI, Groq, Mistral, etc.)
  • Interactive model switching โ€” select a provider at startup or switch anytime via CLI
  • Structured session flow โ€” goal-driven sessions with relevance enforcement
    • Session goals โ€” attach a purpose/topic to each session
    • Soft warning โ€” warns when a prompt appears off-topic, asks to confirm
    • Guard mode โ€” hard-blocks off-topic prompts entirely (opt-in)
    • AI system prompt scoping โ€” the AI is instructed to stay on-topic and redirect unrelated questions
    • Session summary โ€” view a structured overview of the current session at any time
  • CLI-based prompt logging
  • AI response tracking with rich markdown rendering in the terminal
  • Session-based project management
  • Git commit hash integration
  • File-wise prompt mapping
  • Multi-source relevance detection (keyword overlap against first prompt, session goal, and recent conversation)
  • AI contribution reporting
  • Struggle detection (rapid-prompt, sustained, escalating, long-session)

โš™๏ธ Setup & Installation

Prerequisites

  • Python 3.8 or higher
  • Git (for commit hash integration)
  • An API key from any OpenAI-compatible provider (Gemini, OpenAI, Groq, etc.)

1. Clone the Repository

git clone https://github.com/your-repo/AIDevTracker.git
cd AIDevTracker

2. Install as a Package (Recommended)

Installing via setup.py registers the aidt command globally so you can run it from anywhere:

pip install -e .

This installs all dependencies (openai, python-dotenv, rich) automatically and creates the aidt CLI entry point.

Verify the installation:

aidt

You should see the usage/help output.

3. Configure Your LLM Provider

Option A โ€” Interactive (on first run):

Run any command and you'll be prompted to select your provider:

Select your LLM provider:
  1. Gemini
  2. OpenAI
  3. Groq
  4. Other (custom base URL)

Option B โ€” Manual .env file:

Create a .env file in the project root (copy from .env.example):

LLM_API_KEY=your_api_key_here
LLM_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/
LLM_MODEL=gemini-2.5-flash
RELEVANCE_THRESHOLD=0.4
Variable Description Example
LLM_API_KEY Your provider's API key sk-...
LLM_BASE_URL OpenAI-compatible base URL See provider docs
LLM_MODEL Model name to use gemini-2.5-flash
RELEVANCE_THRESHOLD Off-topic detection cutoff (0.0โ€“1.0) 0.4

Common provider URLs:

  • Gemini: https://generativelanguage.googleapis.com/v1beta/openai/
  • OpenAI: https://api.openai.com/v1/
  • Groq: https://api.groq.com/openai/v1/

๐Ÿ”ง Running the Application

All commands use the aidt entry point after installation. If you have not installed via pip install -e ., you can substitute aidt with python -m aidevtracker.main.

Core Commands

aidt ask "your prompt here" [file.py]       # Ask the AI (with optional file context)
aidt analyze [file.py]                       # Run analysis (repo-wide or per-file)
aidt report                                  # Generate detailed AI contribution report
aidt visualize                               # Show visual summary in terminal
aidt export [output.csv]                     # Export all interactions to CSV

Session Management

aidt session new "Project Name" [--goal "Session goal"]   # Create a new session
aidt session list                                          # List all sessions
aidt session use <id>                                      # Switch active session
aidt session guard <on|off>                                # Toggle hard-block guard mode
aidt session summary                                       # Show active session overview

Model Configuration

aidt model                                                 # Switch LLM provider (interactive)
aidt model <API_KEY> --base-url <URL> --model <MODEL>      # Switch LLM provider (direct)

Global Flags

aidt --threshold <0.0-1.0> <command>                       # Override relevance threshold for one command

Quick Start Example

# 1. Install the package
pip install -e .

# 2. Create a new session with a goal
aidt session new "My Web App" --goal "Building the authentication module"

# 3. Ask the AI a question scoped to a file
aidt ask "How should I structure JWT token validation?" auth.py

# 4. Run an analysis on your repo
aidt analyze

# 5. Generate a contribution report
aidt report

๐Ÿ›ก๏ธ Structured Session Flow

Sessions can be created with a goal that defines the session's purpose. This enables:

  1. AI System Prompt Scoping โ€” the AI is primed to stay focused on the session goal and redirect off-topic questions.
  2. Pre-flight Relevance Check โ€” before each AI call, the prompt is compared against three context sources using keyword overlap:
    • First prompt for the file (topical anchor)
    • Session goal (overall scope)
    • Most recent prompt + response (conversational continuity)
    • The max of all scores is used โ€” if relevant to any source, the prompt passes.
  3. Soft Warning (default) โ€” if the prompt scores below the threshold, the developer is warned and asked Proceed anyway? [y/N].
  4. Guard Mode (opt-in) โ€” when enabled via aidt session guard on, off-topic prompts are hard-blocked with no AI call made.
Developer: aidt ask "..." file.py
              โ”‚
              โ–ผ
     Session active AND file has a prior prompt?
              โ”‚
        Yes   โ”œโ”€โ”€ max(keyword_overlap scores) < threshold?
              โ”‚         โ”‚
              โ”‚    Yes   โ”œโ”€โ”€ guard_mode ON  โ†’ ๐Ÿšซ HARD BLOCK
              โ”‚          โ””โ”€โ”€ guard_mode OFF โ†’ โš   Soft warn โ†’ y/N
              โ”‚    No    โ””โ”€โ”€ Proceed
              โ–ผ
     AI responds (system prompt scoped to session goal)
              โ”‚
              โ–ผ
     Relevance scored โ†’ Interaction saved to DB

๐Ÿ—๏ธ Project Structure

AIDevTracker/
โ”œโ”€โ”€ aidevtracker/            # Main Python package
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ main.py              # Entry point (CLI argument parsing)
โ”‚   โ”œโ”€โ”€ cli.py               # Command implementations
โ”‚   โ”œโ”€โ”€ ai_client.py         # LLM provider abstraction
โ”‚   โ”œโ”€โ”€ analyzer.py          # Relevance & contribution analysis
โ”‚   โ”œโ”€โ”€ db.py                # SQLite database layer
โ”‚   โ”œโ”€โ”€ env_utils.py         # .env loading & model configuration
โ”‚   โ”œโ”€โ”€ git_utils.py         # Git commit hash integration
โ”‚   โ””โ”€โ”€ visualizer.py        # Terminal visualizations
โ”œโ”€โ”€ setup.py                 # Package install config (creates `aidt` command)
โ”œโ”€โ”€ .env.example             # Environment variable template
โ”œโ”€โ”€ metadata.md              # Full metadata field reference
โ””โ”€โ”€ README.md

๐Ÿ—๏ธ System Architecture

Architectural_diagram

๐Ÿ”„ Workflow Chart

workflow_diagram

๐Ÿ“Š AI Contribution Evaluation Methodology

AI contribution is measured using the following metrics:

  1. Prompt Count per File

    • Number of AI prompts linked to a specific file.
  2. Git Commit Linkage

    • Each prompt is associated with a commit hash.
  3. Hybrid Relevance Detection

    • Two methods are used and the higher score is taken:
      • SequenceMatcher โ€” catches verbatim text/code reuse
      • Keyword Overlap โ€” catches topical relevance (shared terms)
    • Default threshold = 0.4 (configurable via .env or --threshold flag)
  4. Relevance Classification

    • If score โ‰ฅ threshold โ†’ Marked as AI-contributed.
    • Otherwise โ†’ Marked as non-contributing interaction.
  5. Struggle Detection

    • Rapid-prompt struggle (< 5 min between prompts)
    • Sustained struggle (3+ prompts within a 30-min window)
    • Escalating dependency (prompt frequency accelerating over time)
    • Long session (continuous AI usage over 2+ hours on a file)

These metrics help identify:

  • AI-dependent modules
  • Developer struggle areas
  • AI usage intensity across project timeline

๐Ÿ“‹ Metadata Captured

Per-interaction: prompt, response, file_path, commit_hash, timestamp, prompt_length, response_length, model_used, response_time, relevance, session_id

Per-session: project_name, created_at, goal, guard_mode

See metadata.md for the full reference.


โš ๏ธ Limitations

  • Uses text-based similarity (not semantic embeddings)
  • Mock AI engine used for offline testing
  • Similarity threshold may require tuning
  • No deep architectural inference implemented

๐Ÿ”ฎ Future Enhancements

  • Embedding-based similarity scoring
  • Web dashboard visualization
  • Developer struggle heatmap
  • Architectural drift detection
  • Export reports to PDF

๐Ÿ‘ฅ Team Members

  • Shivam โ€“ System Architecture & Core Implementation
  • Suhail โ€“ API Testing & Database Design
  • Sreeja โ€“ Documentation,analyser.py, System Architecture & workflow chart
  • Anil โ€“ Testing & CLI Validation
  • Harsith โ€“ Research & Architectural Drift Study

๐Ÿ“š Academic Purpose

This project is developed as part of a Software Engineering Lab to study:

  • AI-assisted development traceability
  • Version control integration
  • AI contribution quantification
  • Software maintainability analysis

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aidevtracker-1.0.0.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aidevtracker-1.0.0-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file aidevtracker-1.0.0.tar.gz.

File metadata

  • Download URL: aidevtracker-1.0.0.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for aidevtracker-1.0.0.tar.gz
Algorithm Hash digest
SHA256 221c3c403dd581be7a9f02620883cc90b11b2d375c8309dd941f48033e3fe3f5
MD5 07683f35791113a566a675c429ea189c
BLAKE2b-256 43b40668a883fe2672b7926896b1b5f3bf4420a396ab7cace3123ac3c98075aa

See more details on using hashes here.

File details

Details for the file aidevtracker-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aidevtracker-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for aidevtracker-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e54548faf82279399edf6309ccb7806ccebc215b6d5421c72bdaff63e4f757d
MD5 c4fb90c3613c3a366094ab97acf6ec1a
BLAKE2b-256 a20f82dcea7adef48219cfd394c1ff21bca0351ed127bdf5c5b257da2eaf6f90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page