Skip to content

A self-observing agent that maintains a Prolog knowledge graph relating requirements, code modules, tests, and their interactions. Designed for use with LLMs to understand codebase state and track specification-driven development.

Notifications You must be signed in to change notification settings

dromologue/dromo2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prolog Knowledge Graph Agent

Track requirements, code, and tests in a knowledge graph. Query for coverage gaps and impact analysis.

What It Does

  • Scans any codebase (Python, JavaScript, Go, Rust, etc.)
  • Builds a graph linking requirements → code → tests
  • Finds untested requirements and orphan tests
  • Uses any LLM to understand your code

Quick Start

1. Clone the Agent

git clone https://github.com/dromologue/dromo2.git
cd dromo2

2. Run Setup

./scripts/setup.sh

The wizard will:

  • Check prerequisites
  • Let you choose an LLM (Claude, GPT, Ollama, or custom)
  • Configure your API key
  • Initialize your repository

3. Add Requirements

Edit specs/SPEC.md in your project:

## REQ-001: User Authentication

Users can log in with email and password.

**Acceptance Criteria:**
- [ ] AC-001-01: Valid credentials return session token
- [ ] AC-001-02: Invalid credentials return 401

4. Add Markers to Your Code

In source files:

// IMPLEMENTS: REQ-001

function login(email, password) {
  // ...
}

In test files:

// SPEC: AC-001-01
test('returns session token for valid credentials', () => {
  // ...
});

5. Scan Your Repository

./scripts/scan-kb.sh

6. Query for Gaps

?- query_untested(R).     % Find untested criteria
?- query_coverage(R).     % Get coverage stats
?- query_orphans(R).      % Find tests without specs

Supported LLM Providers

Provider Model API Key
Anthropic claude-sonnet-4-20250514 ANTHROPIC_API_KEY
OpenAI gpt-4o OPENAI_API_KEY
Ollama llama3 (none)
Custom (any) CUSTOM_API_KEY

Manual Setup

If you prefer not to use the wizard:

Prerequisites

Configure LLM

# Anthropic
export ANTHROPIC_API_KEY="your-key"

# OpenAI
export OPENAI_API_KEY="your-key"

# Ollama (no key needed)
ollama serve

Initialize Repository

cd /path/to/your/project

swipl -g "
  use_module('/path/to/dromo2/src/agent'),
  init_repo('.')
" -t halt

Scan Repository

swipl -g "
  use_module('/path/to/dromo2/src/agent'),
  use_module('/path/to/dromo2/src/kb_llm_parser'),
  set_llm_provider(anthropic),
  scan_repo('.')
" -t halt

Project Structure

your-project/
├── specs/
│   ├── SPEC.md              # Your requirements
│   └── .kb-agent.conf       # Agent configuration
├── src/                     # Your source code
├── test/                    # Your tests
└── scripts/
    ├── scan-kb.sh           # Run scans
    └── query-kb.sh          # Interactive queries

Marker Reference

In Specifications

## REQ-XXX: Requirement Title

Description.

**Acceptance Criteria:**
- [ ] AC-XXX-01: Criterion description
- [x] AC-XXX-02: Completed criterion

In Source Code

# IMPLEMENTS: REQ-001
# IMPLEMENTS: REQ-001, REQ-002
// IMPLEMENTS: REQ-001
/* IMPLEMENTS: REQ-001 */
// IMPLEMENTS: REQ-001

In Test Files

# SPEC: AC-001-01
def test_something():
    pass
// SPEC: AC-001-01, AC-001-02
test('description', () => {});

Query Reference

Query Description
status Show summary statistics
query_untested(R) Find untested acceptance criteria
query_unimplemented(R) Find requirements without implementations
query_orphans(R) Find tests without SPEC markers
query_coverage(R) Get coverage percentages
query_impact(module(X), R) Find tests affected by changing module X
query_requirement('REQ-001', R) Get details for a requirement
dump_knowledge_graph Print all facts
export_knowledge_graph_json('out.json') Export to JSON

Documentation


License

MIT

About

A self-observing agent that maintains a Prolog knowledge graph relating requirements, code modules, tests, and their interactions. Designed for use with LLMs to understand codebase state and track specification-driven development.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published