chore: scaffold project structure, licenses, CI and default config
This commit is contained in:
parent
b8b85f18d3
commit
5cbe17d48d
12 changed files with 625 additions and 0 deletions
32
.github/workflows/ci.yml
vendored
Normal file
32
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
RUSTFLAGS: "-D warnings"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Test (${{ matrix.os }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
components: clippy, rustfmt
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
- name: Format check
|
||||||
|
run: cargo fmt --check
|
||||||
|
- name: Clippy check
|
||||||
|
run: cargo clippy --all-targets -- -D warnings
|
||||||
|
- name: Run tests
|
||||||
|
run: cargo test --all-targets --verbose
|
||||||
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
/target
|
||||||
|
.superpowers/
|
||||||
|
**/*.rs.bk
|
||||||
|
Cargo.lock
|
||||||
20
CHANGELOG.md
Normal file
20
CHANGELOG.md
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.1.0] - 2026-09-26
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Core `brokecrew` library with strict CLI/core boundary.
|
||||||
|
- Declarative persona definitions (`personas.toml`) with ranked model fallback lists and stealth model flagging.
|
||||||
|
- Two-stage router: Stage A (zero-cost keyword pre-filter), Stage B (low-token LLM classifier with safe fallback), Stage C (complexity escalation).
|
||||||
|
- Live OpenRouter model catalog cache (`/v1/models`) with background synchronization.
|
||||||
|
- Account-wide rate-limit budget tracker (20 req/min, 50 req/day or 1,000 req/day quota) with persistent JSON state and pre-429 CLI warnings.
|
||||||
|
- Typed multi-agent handoff pipeline executor (`Vec<PipelineStep>`) with streaming output.
|
||||||
|
- Clap-based CLI with subcommands: `chat`, `config set-key`, `personas list`, and `status`.
|
||||||
|
- OS keyring integration via `keyring` crate with env variable and config file fallback.
|
||||||
|
- Structured observability using `tracing` with human-readable and `--json-logs` output modes.
|
||||||
|
- Comprehensive unit, fallback fault-injection, and WireMock integration test suite.
|
||||||
3
CODEOWNERS
Normal file
3
CODEOWNERS
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# BrokeCrew Code Owners
|
||||||
|
* @oiupoyt
|
||||||
|
config/personas*.toml @oiupoyt
|
||||||
90
CONTRIBUTING.md
Normal file
90
CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
# Contributing to BrokeCrew
|
||||||
|
|
||||||
|
Thank you for contributing to BrokeCrew! We want adding personas and extending fallback models to be a **5-minute, zero-code task** that anyone can do.
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
- [Adding a New Persona (No Code Required)](#adding-a-new-persona-no-code-required)
|
||||||
|
- [Local Development Setup](#local-development-setup)
|
||||||
|
- [Testing & Quality Checks](#testing--quality-checks)
|
||||||
|
- [Pull Request Guidelines](#pull-request-guidelines)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Adding a New Persona (No Code Required)
|
||||||
|
|
||||||
|
You do **not** need to touch Rust code to add a persona to BrokeCrew.
|
||||||
|
|
||||||
|
1. Open `config/personas.example.toml` (or your local `~/.config/brokecrew/personas.toml`).
|
||||||
|
2. Append a new `[[persona]]` block:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[persona]]
|
||||||
|
name = "devops"
|
||||||
|
system_prompt = "You are a cloud infrastructure and SRE expert. Produce robust Dockerfiles, Kubernetes manifests, and CI scripts."
|
||||||
|
trigger_words = ["docker", "k8s", "kubernetes", "ci", "deploy", "nginx", "terraform"]
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "meta-llama/llama-3.3-70b-instruct:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "deepseek/deepseek-r1:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "google/gemini-2.0-flash-001"
|
||||||
|
tier = "paid"
|
||||||
|
is_stealth = false
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Test your persona locally:
|
||||||
|
```bash
|
||||||
|
brokecrew chat --persona devops "Write an optimized multistage Dockerfile for Rust"
|
||||||
|
```
|
||||||
|
4. Submit a Pull Request with the tag `good-first-issue`!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Local Development Setup
|
||||||
|
|
||||||
|
Prerequisites:
|
||||||
|
- Rust 1.75+ (or latest stable)
|
||||||
|
- OpenRouter API key (optional for mocked tests; required for live chat)
|
||||||
|
|
||||||
|
Clone and build:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/brokecrew/brokecrew.git
|
||||||
|
cd brokecrew
|
||||||
|
cargo build
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Testing & Quality Checks
|
||||||
|
|
||||||
|
BrokeCrew enforces strict clippy and test passes in CI across Linux, macOS, and Windows.
|
||||||
|
|
||||||
|
Run tests:
|
||||||
|
```bash
|
||||||
|
cargo test
|
||||||
|
```
|
||||||
|
|
||||||
|
Run clippy:
|
||||||
|
```bash
|
||||||
|
cargo clippy --all-targets -- -D warnings
|
||||||
|
```
|
||||||
|
|
||||||
|
Format code:
|
||||||
|
```bash
|
||||||
|
cargo fmt --check
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pull Request Guidelines
|
||||||
|
|
||||||
|
1. Ensure all tests pass and `cargo clippy --all-targets -- -D warnings` reports zero warnings.
|
||||||
|
2. Never commit API keys or private tokens.
|
||||||
|
3. Keep library modules decoupled from CLI formatting.
|
||||||
35
Cargo.toml
Normal file
35
Cargo.toml
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
[package]
|
||||||
|
name = "brokecrew"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
authors = ["oiupoyt <oiupoyt.cat@gmail.com>"]
|
||||||
|
description = "A Rust-native multi-model AI team CLI with resilient OpenRouter fallback routing"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
readme = "README.md"
|
||||||
|
repository = "https://github.com/brokecrew/brokecrew"
|
||||||
|
keywords = ["cli", "llm", "openrouter", "multi-agent", "ai"]
|
||||||
|
categories = ["command-line-utilities", "development-tools"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
tokio = { version = "1.40", features = ["full"] }
|
||||||
|
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] }
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_json = "1.0"
|
||||||
|
toml = "0.8"
|
||||||
|
clap = { version = "4.5", features = ["derive", "env"] }
|
||||||
|
tracing = "0.1"
|
||||||
|
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
|
||||||
|
thiserror = "1.0"
|
||||||
|
async-trait = "0.1"
|
||||||
|
futures-util = "0.3"
|
||||||
|
keyring = { version = "3.0", features = ["linux-native"] }
|
||||||
|
indicatif = "0.17"
|
||||||
|
owo-colors = "4.1"
|
||||||
|
regex = "1.10"
|
||||||
|
chrono = { version = "0.4", features = ["serde"] }
|
||||||
|
dirs = "5.0"
|
||||||
|
tempfile = "3.12"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
wiremock = "0.6"
|
||||||
|
tokio-test = "0.4"
|
||||||
176
LICENSE-APACHE
Normal file
176
LICENSE-APACHE
Normal file
|
|
@ -0,0 +1,176 @@
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
21
LICENSE-MIT
Normal file
21
LICENSE-MIT
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 BrokeCrew Contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
135
README.md
Normal file
135
README.md
Normal file
|
|
@ -0,0 +1,135 @@
|
||||||
|
# BrokeCrew 🤖⚡
|
||||||
|
|
||||||
|
[](https://github.com/brokecrew/brokecrew/actions)
|
||||||
|
[](LICENSE-MIT)
|
||||||
|
[](https://crates.io/crates/brokecrew)
|
||||||
|
|
||||||
|
**A lightweight, resilient, async-first Rust CLI that coordinates a specialized team of AI personas backed by OpenRouter models.**
|
||||||
|
|
||||||
|
BrokeCrew makes free-tier models first-class citizens while eliminating their instability through live model catalog discovery, ranked multi-candidate fallback cascades, account-wide rate-limit budgeting, and multi-agent handoff pipelines.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Why BrokeCrew (vs LiteLLM or RouteLLM)?
|
||||||
|
|
||||||
|
| Feature | BrokeCrew | LiteLLM Proxy / RouteLLM |
|
||||||
|
| :--- | :--- | :--- |
|
||||||
|
| **Footprint & Startup** | Single standalone native binary (~15MB), sub-10ms startup. | Heavy Python runtime, tens of pip dependencies, slower startup. |
|
||||||
|
| **Hardware Fit** | Designed to run smoothly on low-RAM ARM tablets, Raspberry Pis, and local dev boxes. | Heavy memory consumption unsuited for constrained devices. |
|
||||||
|
| **Persona Fallback Walk** | Declarative ranked candidates per persona (`qwen:free` → `deepseek:free` → paid fallback). | Static routing with complex configuration layers. |
|
||||||
|
| **Live Catalog Awareness** | Syncs `/v1/models` in background; skips dropped/offline models before wasting requests. | Often returns raw 404/400 errors when models vanish. |
|
||||||
|
| **Account-Wide Budgeting** | Tracks rolling 20 req/min and daily quotas (50 or 1,000 req/day) across all calls including router. | Typically only tracks proxy tokens, not OpenRouter account limits. |
|
||||||
|
| **Multi-Agent Handoffs** | Built-in typed pipelines (`coder` → `reviewer`) with real-time SSE streaming per persona. | Requires external orchestration frameworks (LangGraph, CrewAI). |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Terminal Experience
|
||||||
|
|
||||||
|
BrokeCrew formats multi-agent discussions like a vibrant team group chat:
|
||||||
|
|
||||||
|
```text
|
||||||
|
$ brokecrew chat --pipeline build-and-review "Write a Rust LRU cache"
|
||||||
|
|
||||||
|
[coder] (qwen/qwen-2.5-coder-32b-instruct:free)
|
||||||
|
Here is a thread-safe, high-performance LRU cache implementation using std::collections::HashMap
|
||||||
|
and a doubly-linked list with generational indexing...
|
||||||
|
|
||||||
|
[reviewer] (meta-llama/llama-3.3-70b-instruct:free)
|
||||||
|
Code Review:
|
||||||
|
1. Concurrency: Eviction edge case when capacity is 0 is unhandled.
|
||||||
|
2. Memory Safety: Generational indices avoid raw pointers; good choice.
|
||||||
|
3. Suggestion: Implement std::borrow::Borrow to allow lookup by &str rather than String.
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Quickstart
|
||||||
|
|
||||||
|
### 1. Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo install brokecrew
|
||||||
|
```
|
||||||
|
|
||||||
|
Or build from source:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/brokecrew/brokecrew.git
|
||||||
|
cd brokecrew
|
||||||
|
cargo install --path .
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Configure OpenRouter API Key
|
||||||
|
|
||||||
|
BrokeCrew securely stores your API key in your OS credential store (`keyring`), never in plaintext:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brokecrew config set-key
|
||||||
|
```
|
||||||
|
|
||||||
|
*(You can also export `OPENROUTER_API_KEY="sk-or-v1-..."` or pass `--api-key` for headless servers).*
|
||||||
|
|
||||||
|
### 3. Start Chatting
|
||||||
|
|
||||||
|
Zero-config instant routing:
|
||||||
|
```bash
|
||||||
|
brokecrew chat "build me a proxy checker site"
|
||||||
|
```
|
||||||
|
*Stage A regex/keyword routing automatically detects "build/site" and dispatches to the `coder` persona in 0ms!*
|
||||||
|
|
||||||
|
Run an interactive team session:
|
||||||
|
```bash
|
||||||
|
brokecrew chat
|
||||||
|
```
|
||||||
|
|
||||||
|
Run a multi-agent handoff pipeline:
|
||||||
|
```bash
|
||||||
|
brokecrew chat --pipeline build-and-review "Implement a token bucket rate limiter in Python"
|
||||||
|
```
|
||||||
|
|
||||||
|
Check model catalog and quota health:
|
||||||
|
```bash
|
||||||
|
brokecrew status
|
||||||
|
```
|
||||||
|
|
||||||
|
List available personas:
|
||||||
|
```bash
|
||||||
|
brokecrew personas list
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Declarative Personas (`personas.toml`)
|
||||||
|
|
||||||
|
Personas are defined in `~/.config/brokecrew/personas.toml` (or `./config/personas.example.toml`):
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[persona]]
|
||||||
|
name = "coder"
|
||||||
|
system_prompt = "You are a precise, terse coding assistant. Output working code, minimal commentary."
|
||||||
|
trigger_words = ["build", "code", "script", "function", "website", "api"]
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "qwen/qwen-2.5-coder-32b-instruct:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "deepseek/deepseek-coder:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "google/gemini-2.0-flash-001"
|
||||||
|
tier = "paid"
|
||||||
|
is_stealth = false
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Dual-licensed under either:
|
||||||
|
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
|
||||||
|
- MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||||
|
|
||||||
|
at your option.
|
||||||
97
config/personas.example.toml
Normal file
97
config/personas.example.toml
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
# BrokeCrew Personas & Pipelines Configuration
|
||||||
|
|
||||||
|
default_persona = "general"
|
||||||
|
router_model = "meta-llama/llama-3.2-3b-instruct:free"
|
||||||
|
complexity_threshold = 7
|
||||||
|
|
||||||
|
[[persona]]
|
||||||
|
name = "coder"
|
||||||
|
system_prompt = "You are a precise, terse coding assistant. Output working code with minimal unnecessary commentary. Always prioritize clean, idiomatic architecture and memory safety."
|
||||||
|
trigger_words = ["build", "code", "script", "function", "website", "api", "rust", "python", "algorithm", "backend", "frontend"]
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "qwen/qwen-2.5-coder-32b-instruct:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "deepseek/deepseek-coder:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "meta-llama/llama-3.3-70b-instruct:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "openrouter/auto:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = true
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "google/gemini-2.0-flash-001"
|
||||||
|
tier = "paid"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona]]
|
||||||
|
name = "reviewer"
|
||||||
|
system_prompt = "You are a meticulous, security-minded code reviewer. Flag bugs, performance regressions, security vulnerabilities, and code smell. Do not rewrite unless asked."
|
||||||
|
trigger_words = ["review", "check", "audit", "critique", "inspect", "lint", "vulnerability", "security"]
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "meta-llama/llama-3.3-70b-instruct:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "deepseek/deepseek-chat:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "google/gemini-2.0-flash-001"
|
||||||
|
tier = "paid"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona]]
|
||||||
|
name = "architect"
|
||||||
|
system_prompt = "You are a senior principal systems architect. Spec out distributed systems, data models, scalability tradeoffs, and high-level software blueprints."
|
||||||
|
trigger_words = ["design", "architecture", "system", "structure", "schema", "scale", "spec", "blueprint"]
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "meta-llama/llama-3.3-70b-instruct:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "deepseek/deepseek-r1:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "anthropic/claude-3.5-sonnet"
|
||||||
|
tier = "paid"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona]]
|
||||||
|
name = "general"
|
||||||
|
system_prompt = "You are BrokeCrew's general assistant: insightful, direct, and concise."
|
||||||
|
trigger_words = ["help", "explain", "summarize", "what", "who", "why", "how", "hello"]
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "meta-llama/llama-3.3-70b-instruct:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[persona.candidates]]
|
||||||
|
id = "qwen/qwen-2.5-72b-instruct:free"
|
||||||
|
tier = "free"
|
||||||
|
is_stealth = false
|
||||||
|
|
||||||
|
[[pipeline]]
|
||||||
|
name = "build-and-review"
|
||||||
|
steps = [
|
||||||
|
{ persona = "coder" },
|
||||||
|
{ persona = "reviewer", pass_previous_output = true }
|
||||||
|
]
|
||||||
3
src/lib.rs
Normal file
3
src/lib.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
//! BrokeCrew: A Rust-Native Multi-Model AI Team Library
|
||||||
|
|
||||||
|
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
9
src/main.rs
Normal file
9
src/main.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
//! BrokeCrew CLI Entrypoint
|
||||||
|
//!
|
||||||
|
//! A thin executable layer over the `brokecrew` library.
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
println!("BrokeCrew CLI v{}", env!("CARGO_PKG_VERSION"));
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue