{"id":13602845,"url":"https://github.com/unit-mesh/co-mate","last_synced_at":"2026-02-09T11:37:07.888Z","repository":{"id":171193451,"uuid":"647198683","full_name":"unit-mesh/co-mate","owner":"unit-mesh","description":"ArchGuard Co-mate is an AI-powered architecture copilot, design and governance tools.","archived":false,"fork":false,"pushed_at":"2023-09-19T02:03:52.000Z","size":16821,"stargazers_count":95,"open_issues_count":0,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T07:54:19.447Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unit-mesh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":"docs/governance/BACKEND-BASIC.md","roadmap":null,"authors":null}},"created_at":"2023-05-30T09:12:10.000Z","updated_at":"2025-02-26T15:47:53.000Z","dependencies_parsed_at":"2024-01-16T22:21:25.486Z","dependency_job_id":"3fe95165-8e7b-4a77-a017-1265a3bbd773","html_url":"https://github.com/unit-mesh/co-mate","commit_stats":null,"previous_names":["archguard/archguard-comate","archguard/co-mate","archguard/comate"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unit-mesh%2Fco-mate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unit-mesh%2Fco-mate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unit-mesh%2Fco-mate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unit-mesh%2Fco-mate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unit-mesh","download_url":"https://codeload.github.com/unit-mesh/co-mate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249982561,"owners_count":21355719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T18:01:40.283Z","updated_at":"2026-02-09T11:37:02.868Z","avatar_url":"https://github.com/unit-mesh.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/archguard/co-mate\"\u003e\u003cimg alt=\"XMonad logo\" src=\"docs/co-mate.svg\" height=150\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://openjdk.java.net/\"\u003e\u003cimg alt=\"Java support\" src=\"https://img.shields.io/badge/Java-11+-green?logo=java\u0026logoColor=white\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://coveralls.io/github/archguard/co-mate?branch=master\"\u003e\u003cimg alt=\"Coverage Status\" src=\"https://coveralls.io/repos/github/archguard/co-mate/badge.svg?branch=master\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://kotlinlang.org/\"\u003e\u003cimg alt=\"languages\" src=\"https://img.shields.io/badge/language-kotlin-blueviolet?logo=kotlin\u0026logoColor=white\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/license/mpl-2-0/\"\u003e\u003cimg alt=\"GitHub license\" src=\"https://img.shields.io/github/license/archguard/co-mate\"\u003e\u003c/a\u003e\n    \u003cbrs\u003e\n    \u003cimg alt=\"GitHub tag (latest by date)\" src=\"https://img.shields.io/github/v/tag/archguard/co-mate\"\u003e\n\u003c/p\u003e\n\n# ArchGuard Co-mate\n\nCo-mate is an AI-powered software architecture copilot, design and governance tools.\n\nProject Kanban: https://github.com/orgs/archguard/projects/5/views/1\n\nSupported languages by [ArchGuard](https://github.com/archguard/archguard)\nand [Chapi](https://github.com/modernizing/chapi):\nJava, Kotlin, TypeScript/JavaScript, Golang, Python\n\n## Design Principles\n\n1. DSL as Ubiquitous Language: Empower efficient communication between humans and machines by employing a\n   Domain-Specific Language (DSL).\n2. Atomic LLM for Orchestration: Harness the atomic capabilities of a Language Model (LLM) to construct intricate\n   behaviors within the DSL.\n3. Dynamic Context by Layered: Divide the context into layers to handle complexities effectively through the LLM.\n\n## Usage\n\n1. download the latest release from [release page](https://github.com/archguard/co-mate/releases)\n2. please put `OPENAI_API_KEY=xxx` in `~/.comate/.env`\n3. run `java -jar comate-cli-*-all.jar` replace `*` with the version number\n\n`.env` file example:\n\n```\nOPENAI_API_KEY=xxx\nOPENAI_API_PROXY=xxxx (optional, if you had a OpenAI proxy server)\n```\n\n## Development\n\n### Setup\n\nPrerequisites: Node.js 16+, Java 11+\n\n1. Clone\n\n```\ngit clone https://github.com/archguard/co-mate\n```\n\n2. Setup backend server\n\n```\n./gradlew :comate-server:run\n```\n\n3. Setup frontend GUI\n\n```shell\ncd comate-gui\n\npnpm install\npnpm dev\n```\n\n### Modules\n\n- `comate-server`: server side which provide REST API\n- `comate-gui`: web GUI\n- `comate-cli`: command line interface  [todo]\n\nCore modules:\n\n- `comate-core`: core logic, handle ArchGuard API, LLM logic, etc.\n- LLM modules:\n    - `llm-core`: large language model core, like OpenAI call, Token calculate, Tokenizer, Embedding, Similarity for\n      Embedding, etc.\n- Architecture Spec\n    - `spec-lang`: the Kotlin DSL for architecture's specification, like: Domain Driven Design, RESTful API, etc.\n    - `spec-runtime`: the Kotlin REPL/Interpreter for Architecture Spec DSL\n    - `spec-partitioner`: the partitioner for partitioning the architecture spec document\n- Architecture Define\n    - `architecture`: architecture model\n\n### Tech Stack\n\n- GUI: Next.js + React + AI.js\n- Server: Kotlin + Ktor\n- DSL: Kotlin Type-Safe DSL\n- Code Engine: ArchGuard \u0026 ArchGuard CodeDB\n\n## Specification Language/DSL\n\n```kotlin\ndomain {\n    context_map(\"TicketBooking\") {\n        context(\"Reservation\") {}\n        context(\"Ticket\") {}\n\n        mapping {\n            context(\"Reservation\") dependedOn context(\"Ticket\")\n            context(\"Reservation\") dependedOn context(\"Movie\")\n        }\n    }\n}\n```\n\n### User Journey\n\n```kotlin\ncaseflow(\"MovieTicketBooking\", defaultActor = \"User\") {\n    // activity's should consider all user activities\n    activity(\"AccountManage\") {\n        // task part should include all user tasks under the activity\n        task(\"UserRegistration\") {\n            // you should list key steps in the story\n            stories = listOf(\"Register with email\", \"Register with phone\")\n        }\n        task(\"UserLogin\") {\n            stories += \"Login to the website\"\n        }\n    }\n    activity(\"MovieSelection\") {}\n    // ...\n    activity(\"PaymentCancel\") {\n        task(\"ConfirmCancel\") {\n            actor = \"Admin\" // if some task is role-specific, you can specify it here\n            //...\n        }\n    }\n}\n```\n\n### Concepts \n\n```kotlin\nconcepts {\n    val customer = Concept(\"Customer\") {\n        behavior(\"Place Order\", \"Place an order for a coffee\")\n        behaviors = listOf(\n            \"View Menu\",\n            \"Add to Cart\",\n            \"Remove from Cart\",\n            \"Place Order\",\n            \"Pay\",\n            \"View Order Status\",\n            \"View Order History\",\n            \"Customize Order\"\n        )\n    }\n\n    val barista = Concept(\"Barista\") {\n        behavior(\"Make Coffee\")\n    }\n\n    val deliveryPerson = Concept(\"Delivery Person\") {\n        behavior(\"Deliver Order\")\n    }\n\n    val shoppingCart = Concept(\"Shopping Cart\") {\n        behavior(\"Add to Cart\", \"Add a coffee to the shopping cart\")\n        behavior(\"Remove from Cart\", \"Remove a coffee from the shopping cart\")\n        behavior(\"View Cart\", \"View the contents of the shopping cart\")\n        behavior(\"Checkout\", \"Proceed to checkout and place the order\")\n    }\n\n    relations {\n        customer[\"View Menu\"] perform barista\n        customer[\"View Order History\"] perform barista\n\n        customer[\"Add to Cart\"] perform shoppingCart\n        customer[\"Remove from Cart\"] perform shoppingCart\n        customer[\"View Cart\"] perform shoppingCart\n\n        customer[\"Checkout\"] perform barista\n        customer[\"Place Order\"] perform barista\n\n        customer[\"Pay\"] perform deliveryPerson\n        customer[\"View Order Status\"] perform deliveryPerson\n        customer[\"Customize Order\"].perform(barista) {\n            // condition(\"\").action(\"\") // when need\n        }\n    }\n}\n```\n\n### Foundation\n\n```kotlin\nfoundation {\n    project_name {\n        pattern(\"^([a-z0-9-]+)-([a-z0-9-]+)-([a-z0-9-]+)(-common)?\\$\")\n        example(\"system1-servicecenter1-microservice1\")\n    }\n\n    layered {\n        layer(\"interface\") {\n            pattern(\".*\\\\.interface\") { name shouldBe endsWith(\"Controller\", \"Service\") }\n        }\n        layer(\"application\") {\n            pattern(\".*\\\\.application\") {\n                name shouldBe endsWith(\"DTO\", \"Request\", \"Response\", \"Factory\", \"Service\")\n            }\n        }\n        layer(\"domain\") {\n            pattern(\".*\\\\.domain\") { name shouldBe endsWith(\"Entity\") }\n        }\n        layer(\"infrastructure\") {\n            pattern(\".*\\\\.infrastructure\") { name shouldBe endsWith(\"Repository\", \"Mapper\") }\n        }\n\n        dependency {\n            \"interface\" dependedOn \"domain\"\n            \"interface\" dependedOn \"application\"\n            \"interface\" dependedOn \"infrastructure\"\n            \"application\" dependedOn \"domain\"\n            \"application\" dependedOn \"infrastructure\"\n            \"domain\" dependedOn \"infrastructure\"\n        }\n    }\n\n    naming {\n        class_level {\n            style(\"CamelCase\")\n            pattern(\".*\") { name shouldNotBe contains(\"$\") }\n        }\n        function_level {\n            style(\"CamelCase\")\n            pattern(\".*\") { name shouldNotBe contains(\"$\") }\n        }\n    }\n}\n```\n\nfor MVC:\n\n```kotlin\nfoundation {\n    project_name {\n        pattern(\"^([a-z0-9-]+)-([a-z0-9-]+)(-common)?\\$\")\n        example(\"system1-webapp1\")\n    }\n\n    layered {\n        layer(\"controller\") {\n            pattern(\".*\\\\.controller\") { name shouldBe endsWith(\"Controller\") }\n        }\n        layer(\"service\") {\n            pattern(\".*\\\\.service\") {\n                name shouldBe endsWith(\"DTO\", \"Request\", \"Response\", \"Factory\", \"Service\")\n            }\n        }\n        layer(\"repository\") {\n            pattern(\".*\\\\.repository\") { name shouldBe endsWith(\"Entity\", \"Repository\", \"Mapper\") }\n        }\n\n        dependency {\n            \"controller\" dependedOn \"service\"\n            \"controller\" dependedOn \"repository\"\n            \"service\" dependedOn \"repository\"\n        }\n    }\n\n    naming {\n        class_level {\n            style(\"CamelCase\")\n            pattern(\".*\") { name shouldNotBe contains(\"$\") }\n        }\n        function_level {\n            style(\"CamelCase\")\n            pattern(\".*\") { name shouldNotBe contains(\"$\") }\n        }\n    }\n}\n```\n\n### REST API\n\n```kotlin\nrest_api {\n    uri_construction {\n        pattern(\"/api\\\\/[a-zA-Z0-9]+\\\\/v[0-9]+\\\\/[a-zA-Z0-9\\\\/\\\\-]+\")\n        example(\"/api/petstore/v1/pets/dogs\")\n    }\n\n    http_action(\"GET\", \"POST\", \"PUT\", \"DELETE\")\n    status_code(200, 201, 202, 204, 400, 401, 403, 404, 500, 502, 503, 504)\n\n    security(\n        \"\"\"\nToken Based Authentication (Recommended) Ideally, microservices should be stateless so the service instances can be scaled out easily and the client requests can be routed to multiple independent service providers. A token based authentication mechanism should be used instead of session based authentication\n        \"\"\".trimIndent()\n    )\n\n    misc(\"\"\"\"\"\")\n}\n```\n\nSimilar Project:\n\n- [AutoDoc](https://github.com/context-labs/autodoc). Autodoc is an experimental toolkit for auto-generating codebase documentation for git repositories using Large\n  Language Models, like GPT-4 or Alpaca. Autodoc can be installed in your repo in about 5 minutes. It indexes your\n  codebase through a depth-first traversal of all repository contents and calls an LLM to write documentation for each\n  file and folder. These documents can be combined to describe the different components of your system and how they work\n  together.\n\nLicense\n---\n\nThis code is distributed under the MPL license. See `LICENSE` in this directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funit-mesh%2Fco-mate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funit-mesh%2Fco-mate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funit-mesh%2Fco-mate/lists"}