Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,43 @@ Inside the interactive CLI:

When Route is on, the footer shows the configured execution models. Every completed routing decision is also stored in the session JSONL for audit.

## Customizing Route Rules

Route rules, heuristic keywords, file extension mappings, project markers, and the default provider can all be customized in `~/.openabcode/agent/settings.json` (global) or `.openabcode/settings.json` (project-level). When a field is set, it fully replaces the corresponding built-in default.

```json
{
"router": {
"rules": {
"openai": "Test and automation — algorithms, code review, testing, data analysis, scripting",
"google": "Google ecosystem — Android, Flutter, Firebase, Google Cloud, Kotlin",
"anthropic": "General development — all code writing, editing, debugging, architecture, UI"
},
"keywords": {
"openai": ["algorithm", "unit test", "benchmark", "data analysis", "pipeline"],
"google": ["android", "flutter", "dart", "firebase", "gcp"],
"anthropic": ["refactor", "debug", "architecture", "implement", "fix"]
},
"fileExtensions": {
".kt": "google",
".dart": "google",
".rs": "anthropic",
".ts": "anthropic",
".sh": "openai"
},
"projectMarkers": {
"pubspec.yaml": "google",
"cargo.toml": "anthropic",
"package.json": "anthropic",
"main.tf": "openai"
},
"defaultProvider": "anthropic"
}
}
```

Each field is optional and independent — only configure what you want to override.

## Architecture

```text
Expand Down
14 changes: 10 additions & 4 deletions packages/coding-agent/src/core/agent-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ import {
pickRouteModel,
ROUTE_PROVIDER_CHOICES,
ROUTING_ENTRY_TYPE,
type RouterConfig,
type RoutingDecision,
type RoutingMethod,
} from "./router.ts";
Expand Down Expand Up @@ -1613,10 +1614,14 @@ export class AgentSession {
}

const decisionID = `rtd_${randomUUID()}`;
const heuristic = classifyProviderHeuristic(
{ text, projectFiles },
this.settingsManager.getRouterHeuristicKeywords(),
);
const routerConfig: RouterConfig = {
keywords: this.settingsManager.getRouterHeuristicKeywords(),
rules: this.settingsManager.getRouterHeuristicRules(),
fileExtensions: this.settingsManager.getRouterHeuristicFileExtensions() as RouterConfig["fileExtensions"],
projectMarkers: this.settingsManager.getRouterHeuristicProjectMarkers() as RouterConfig["projectMarkers"],
defaultProvider: this.settingsManager.getRouterDefaultProvider() as ProviderChoice | undefined,
};
const heuristic = classifyProviderHeuristic({ text, projectFiles }, routerConfig);

let choice: ProviderChoice;
let method: RoutingMethod;
Expand Down Expand Up @@ -1645,6 +1650,7 @@ export class AgentSession {
: auth.headers,
env: auth.env,
},
routerConfig,
);
method = "classifier";
usedClassifier = true;
Expand Down
Loading
Loading