Skip to content

openrewrite/rewrite-prethink

Repository files navigation

OpenRewrite Logo

rewrite-prethink

ci Maven Central Revved up by Develocity Contributing Guide

What is this?

This project implements a Rewrite module that generates trusted context for LLM coding agents like Claude Code, Cursor, and GitHub Copilot.

Prethink pre-generates knowledge about your codebase and stores it in .moderne/context/ as CSV files with accompanying markdown documentation. This context helps coding agents understand your codebase without consuming precious context window space reading source files.

Features

  • FINOS CALM Architecture: Generate architecture diagrams following the FINOS CALM (Common Architecture Language Model) standard
  • Context Export: Export data tables to CSV with markdown documentation for agent consumption
  • Agent Configuration: Automatically update coding agent configuration files to reference generated context

CALM Architecture

Prethink generates FINOS CALM architecture diagrams by analyzing your codebase for:

  • Services: REST controllers (Spring MVC, JAX-RS, Micronaut, Quarkus)
  • Databases: JPA entities, Spring Data repositories, JDBC templates
  • External Services: RestTemplate, WebClient, Feign clients, Apache HttpClient
  • Messaging: Kafka, RabbitMQ, JMS, Spring Cloud Stream

The generated calm-architecture.json follows the CALM schema and can be visualized with CALM-compatible tools.

Data Tables

Prethink provides data tables for architectural components:

Table Description
ServiceEndpoints REST API endpoints with HTTP methods and paths
DatabaseConnections Database entities and repositories
ExternalServiceCalls Outbound HTTP client calls
MessagingConnections Message queue producers and consumers
ServerConfiguration Server port, protocol, and context path
SecurityConfiguration Security settings including CORS and OAuth2
DataAssets Domain entities, DTOs, and records
DeploymentArtifacts Dockerfile, Kubernetes, and docker-compose files
ProjectMetadata Project coordinates and description

Agent Configuration

Prethink automatically updates coding agent configuration files to reference the generated context:

  • CLAUDE.md - Claude Code
  • .cursorrules - Cursor
  • .github/copilot-instructions.md - GitHub Copilot

Usage

This library provides the core Prethink infrastructure. For a complete solution with architectural discovery recipes, see Moderne Prethink.

Contributing

We appreciate all types of contributions. See the contributing guide for detailed instructions on how to get started.

About

Trusted context for LLM coding agents

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages