aia 2.0.0.0.pre.beta2 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +152 -223
- data/README.md +41 -18
- data/bin/aia +8 -3
- data/lib/aia/aia_completion.bash +2 -3
- data/lib/aia/aia_completion.fish +6 -5
- data/lib/aia/aia_completion.zsh +2 -3
- data/lib/aia/chat_loop.rb +16 -14
- data/lib/aia/config/cli_parser.rb +123 -91
- data/lib/aia/config/defaults.yml +18 -40
- data/lib/aia/config/mcp_parser.rb +30 -36
- data/lib/aia/config/model_spec.rb +8 -14
- data/lib/aia/config/validator.rb +102 -103
- data/lib/aia/config/value_caster.rb +76 -0
- data/lib/aia/config.rb +70 -53
- data/lib/aia/crew.rb +29 -19
- data/lib/aia/debate_handler.rb +27 -10
- data/lib/aia/directives/configuration_directives.rb +55 -14
- data/lib/aia/directives/context_directives.rb +24 -12
- data/lib/aia/directives/execution_directives.rb +18 -23
- data/lib/aia/directives/model_directives.rb +41 -104
- data/lib/aia/directives/utility_directives.rb +16 -17
- data/lib/aia/directives/web_and_file_directives.rb +21 -14
- data/lib/aia/fact_asserter.rb +3 -3
- data/lib/aia/history_transfer.rb +64 -24
- data/lib/aia/logger.rb +14 -46
- data/lib/aia/mcp_config_normalizer.rb +27 -14
- data/lib/aia/mcp_connection_manager.rb +181 -184
- data/lib/aia/mcp_discovery.rb +43 -15
- data/lib/aia/mcp_grouper.rb +2 -1
- data/lib/aia/mcp_server_config.rb +20 -2
- data/lib/aia/mcp_utility.rb +24 -19
- data/lib/aia/mention_router.rb +15 -2
- data/lib/aia/modality_query.rb +36 -0
- data/lib/aia/model_alias_registry.rb +11 -11
- data/lib/aia/model_registry.rb +75 -0
- data/lib/aia/network_builder.rb +8 -7
- data/lib/aia/patches/mcp_stdio_stderr.rb +102 -0
- data/lib/aia/patches/ruby_llm_streaming_error.rb +21 -4
- data/lib/aia/patches/ruby_llm_tool_param_compat.rb +18 -0
- data/lib/aia/pipeline_orchestrator.rb +71 -38
- data/lib/aia/prompt_decomposer.rb +1 -1
- data/lib/aia/prompt_handler.rb +56 -29
- data/lib/aia/provider_registry.rb +105 -0
- data/lib/aia/robot_builder.rb +1 -1
- data/lib/aia/robot_factory.rb +67 -63
- data/lib/aia/robot_sync.rb +79 -0
- data/lib/aia/role_catalog.rb +89 -0
- data/lib/aia/session.rb +25 -11
- data/lib/aia/skill_utils.rb +60 -19
- data/lib/aia/spawn_handler.rb +16 -4
- data/lib/aia/spawn_spec_parser.rb +6 -7
- data/lib/aia/special_mode_handler.rb +28 -25
- data/lib/aia/speech.rb +70 -34
- data/lib/aia/startup_coordinator.rb +17 -92
- data/lib/aia/streaming_runner.rb +10 -2
- data/lib/aia/system_prompt_assembler.rb +12 -11
- data/lib/aia/task_board.rb +60 -0
- data/lib/aia/tool_approver.rb +205 -0
- data/lib/aia/tool_filter.rb +1 -10
- data/lib/aia/tool_filter_strategy.rb +12 -1
- data/lib/aia/tool_introspection.rb +9 -1
- data/lib/aia/tool_loader.rb +67 -33
- data/lib/aia/tool_utility.rb +6 -5
- data/lib/aia/tools/delegate_to_foreman_tool.rb +6 -4
- data/lib/aia/tools/recruit_robot_tool.rb +12 -12
- data/lib/aia/tools/reskill_robot_tool.rb +7 -7
- data/lib/aia/tools/task_board_tool.rb +16 -16
- data/lib/aia/trakflow_bridge.rb +14 -8
- data/lib/aia/turn_state.rb +31 -8
- data/lib/aia/ui_presenter.rb +16 -0
- data/lib/aia/utility.rb +6 -24
- data/lib/aia/variable_input_collector.rb +0 -3
- data/lib/aia/verification_network.rb +9 -10
- data/lib/aia/version.rb +1 -9
- data/lib/aia.rb +34 -8
- metadata +20 -161
- data/.better-commits.json +0 -150
- data/.config/tocer/configuration.yml +0 -6
- data/.envrc +0 -19
- data/.loki +0 -11
- data/.reek.yml +0 -160
- data/.rubocop.yml +0 -116
- data/.rubocop_strict.yml +0 -15
- data/.version +0 -1
- data/COMMITS.md +0 -196
- data/IMPLEMENTATION_PLAN.md +0 -506
- data/Rakefile +0 -47
- data/_typos.toml +0 -10
- data/aia.gemspec +0 -92
- data/architecture_review.md +0 -314
- data/config/aia.yml +0 -13
- data/docs/AGENTS.md +0 -40
- data/docs/advanced-prompting.md +0 -814
- data/docs/assets/images/aia.png +0 -0
- data/docs/cli-reference.md +0 -1241
- data/docs/configuration.md +0 -747
- data/docs/contributing.md +0 -386
- data/docs/directives-reference.md +0 -1145
- data/docs/examples/index.md +0 -277
- data/docs/examples/mcp/index.md +0 -475
- data/docs/examples/prompts/analysis/index.md +0 -78
- data/docs/examples/prompts/automation/index.md +0 -109
- data/docs/examples/prompts/development/index.md +0 -125
- data/docs/examples/prompts/index.md +0 -333
- data/docs/examples/prompts/learning/index.md +0 -127
- data/docs/examples/prompts/writing/index.md +0 -62
- data/docs/examples/tools/index.md +0 -282
- data/docs/faq.md +0 -578
- data/docs/guides/available-models.md +0 -366
- data/docs/guides/basic-usage.md +0 -478
- data/docs/guides/chat.md +0 -680
- data/docs/guides/crew.md +0 -239
- data/docs/guides/executable-prompts.md +0 -331
- data/docs/guides/first-prompt.md +0 -454
- data/docs/guides/getting-started.md +0 -455
- data/docs/guides/image-generation.md +0 -507
- data/docs/guides/index.md +0 -48
- data/docs/guides/local-models.md +0 -306
- data/docs/guides/migrate-prompts.md +0 -335
- data/docs/guides/models.md +0 -1017
- data/docs/guides/shared-tools.md +0 -254
- data/docs/guides/tools.md +0 -831
- data/docs/index.md +0 -259
- data/docs/installation.md +0 -274
- data/docs/mcp-integration.md +0 -603
- data/docs/prompt_management.md +0 -665
- data/docs/security.md +0 -674
- data/docs/special_projects_guide.md +0 -386
- data/docs/tools-and-mcp-examples.md +0 -1211
- data/docs/workflows-and-pipelines.md +0 -636
- data/examples/.gitignore +0 -2
- data/examples/00_setup_aia.sh +0 -111
- data/examples/01_basic_usage.sh +0 -23
- data/examples/02_frontmatter.sh +0 -33
- data/examples/03_shell_integration.sh +0 -55
- data/examples/04_erb_templating.sh +0 -56
- data/examples/05_shell_then_erb.sh +0 -38
- data/examples/06_prompt_chaining.sh +0 -59
- data/examples/07_pipeline.sh +0 -46
- data/examples/08_context_files.sh +0 -43
- data/examples/09_roles.sh +0 -67
- data/examples/10_stdin_piping.sh +0 -49
- data/examples/11_multi_model.sh +0 -65
- data/examples/12_token_usage.sh +0 -52
- data/examples/13_cost_tracking.sh +0 -68
- data/examples/14_output_file.sh +0 -91
- data/examples/15_parameters.sh +0 -68
- data/examples/16_directives.sh +0 -113
- data/examples/17_require_and_conditionals.sh +0 -68
- data/examples/18_tools.sh +0 -61
- data/examples/19_local_tools.sh +0 -34
- data/examples/20_mcp_servers.sh +0 -102
- data/examples/21_executable_prompts.sh +0 -78
- data/examples/22_chat_mode.sh +0 -217
- data/examples/23_verify.sh +0 -139
- data/examples/24_decompose.sh +0 -139
- data/examples/25_spawn.sh +0 -139
- data/examples/26_debate.sh +0 -97
- data/examples/27_mention_routing.sh +0 -157
- data/examples/28_model_switching.sh +0 -106
- data/examples/29_agent_harness.sh +0 -177
- data/examples/README.md +0 -321
- data/examples/advanced_multi_robot_capabilities_without_examples.md +0 -106
- data/examples/aia_config.yml +0 -22
- data/examples/aia_config_orchestrator.yml +0 -45
- data/examples/aia_config_with_mcp.yml +0 -21
- data/examples/common.sh +0 -39
- data/examples/context/project_goals.md +0 -6
- data/examples/context/tech_stack.md +0 -7
- data/examples/directives/timestamp_directive.rb +0 -22
- data/examples/mcp/filesystem.json +0 -9
- data/examples/prompts_dir/analyze.md +0 -2
- data/examples/prompts_dir/brainstorm.md +0 -2
- data/examples/prompts_dir/conditional.md +0 -17
- data/examples/prompts_dir/creative.md +0 -4
- data/examples/prompts_dir/erbinfo.md +0 -5
- data/examples/prompts_dir/erbinfo_raw.md +0 -8
- data/examples/prompts_dir/evaluate.md +0 -2
- data/examples/prompts_dir/explain_joke.md +0 -1
- data/examples/prompts_dir/explain_recursion.md +0 -1
- data/examples/prompts_dir/fun_fact +0 -3
- data/examples/prompts_dir/greeting.md +0 -8
- data/examples/prompts_dir/greeting_required.md +0 -7
- data/examples/prompts_dir/hello.md +0 -1
- data/examples/prompts_dir/includes/ruby_facts.md +0 -4
- data/examples/prompts_dir/limerick.md +0 -1
- data/examples/prompts_dir/list_with_mcp.md +0 -3
- data/examples/prompts_dir/pick_best.md +0 -2
- data/examples/prompts_dir/project_summary +0 -12
- data/examples/prompts_dir/quiz_with_include.md +0 -6
- data/examples/prompts_dir/require_demo.md +0 -5
- data/examples/prompts_dir/roles/formal.md +0 -3
- data/examples/prompts_dir/roles/orchestrator.md +0 -21
- data/examples/prompts_dir/roles/pirate.md +0 -3
- data/examples/prompts_dir/shell_then_erb.md +0 -6
- data/examples/prompts_dir/sort_compare.md +0 -2
- data/examples/prompts_dir/summarize_context.md +0 -2
- data/examples/prompts_dir/sysinfo.md +0 -5
- data/examples/prompts_dir/sysinfo_raw.md +0 -8
- data/examples/prompts_dir/tagline.md +0 -1
- data/examples/prompts_dir/tell_joke.md +0 -1
- data/examples/prompts_dir/tell_joke_with_next.md +0 -4
- data/examples/prompts_dir/use_local_tool.md +0 -8
- data/examples/prompts_dir/use_tools.md +0 -8
- data/examples/prompts_dir/weather.md +0 -2
- data/examples/prompts_dir/whats_new.md +0 -2
- data/examples/prompts_dir/with_timestamp.md +0 -5
- data/examples/requirements/sinatra_taskflow_app.md +0 -139
- data/examples/rules/01_classify_ruby.rb +0 -16
- data/examples/rules/02_prefer_claude_for_code.rb +0 -19
- data/examples/rules/03_gate_prompt_length.rb +0 -19
- data/examples/rules/04_tool_selection.rb +0 -41
- data/examples/rules/README.md +0 -30
- data/examples/run_all.sh +0 -294
- data/examples/tools/word_count_tool.rb +0 -30
- data/lib/AGENTS.md +0 -57
- data/lib/aia/model_switch_handler.rb +0 -100
- data/mcp_servers/README.md +0 -110
- data/mcp_servers/apple-mcp.json +0 -8
- data/mcp_servers/filesystem.json +0 -9
- data/mcp_servers/mcp_server_chart.json +0 -11
- data/mcp_servers/playwright_one.json +0 -8
- data/mcp_servers/playwright_server_definition.json +0 -9
- data/mcp_servers/playwright_two.json +0 -8
- data/mcp_servers/tavily_mcp_server.json +0 -8
- data/mkdocs.yml +0 -169
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Explain why the joke above is funny. Keep it to two sentences.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Explain recursion to a beginner in three sentences.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Say hello and briefly introduce yourself in two sentences.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Write a limerick about a programmer who loves Ruby.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env aia -c aia_config.yml --no-output
|
|
2
|
-
---
|
|
3
|
-
temperature: 0.3
|
|
4
|
-
---
|
|
5
|
-
Summarize this project based on the following information:
|
|
6
|
-
|
|
7
|
-
Gemspec name: <%= `grep 'spec.name' ../*.gemspec 2>/dev/null`.strip %>
|
|
8
|
-
Ruby version: <%= RUBY_VERSION %>
|
|
9
|
-
Current directory: $(pwd)
|
|
10
|
-
Files in lib/: $(ls ../lib/aia/*.rb 2>/dev/null | wc -l | tr -d ' ')
|
|
11
|
-
|
|
12
|
-
Provide a three-sentence overview.
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
I have a JSON document with the following structure:
|
|
2
|
-
|
|
3
|
-
<%= JSON.pretty_generate({ "project" => "aia", "version" => "1.0.0-beta", "languages" => ["Ruby"], "features" => ["prompt management", "multi-model", "directives", "pipelines"] }) %>
|
|
4
|
-
|
|
5
|
-
Summarize what this project does in two sentences based on the JSON above.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
You are Tobor, the primary AI orchestrator in this session.
|
|
2
|
-
|
|
3
|
-
Your role is to coordinate a team of specialized robots to handle complex tasks.
|
|
4
|
-
Think like a project director: delegate what can be parallelized, direct what
|
|
5
|
-
requires deep specialization, and synthesize what needs holistic judgment.
|
|
6
|
-
|
|
7
|
-
When you receive a request, apply this decision framework:
|
|
8
|
-
|
|
9
|
-
- **Direct response**: Simple, self-contained questions — answer yourself.
|
|
10
|
-
- **/spawn specialist-type**: Questions requiring narrow domain expertise.
|
|
11
|
-
This creates a specialist lead agent on the fly and routes the task to it.
|
|
12
|
-
Example: `/spawn security-expert` before asking about API hardening.
|
|
13
|
-
- **/decompose**: Complex requests with multiple independent dimensions.
|
|
14
|
-
This splits the task into parallel workstreams across your robot team,
|
|
15
|
-
then synthesizes the results into a unified response.
|
|
16
|
-
- **/delegate**: Structured multi-step tasks where steps have dependencies.
|
|
17
|
-
This creates a tracked execution plan with ordered hand-offs between robots.
|
|
18
|
-
|
|
19
|
-
Always be explicit about which coordination strategy you are using and why.
|
|
20
|
-
When you spawn or decompose, briefly state the workstreams or specialist roles
|
|
21
|
-
before execution so the user understands the plan.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Write a catchy one-line tagline for the gem name chosen above.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Tell me a short, clean joke about computers.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
Use the word_count tool to analyze the following passage:
|
|
2
|
-
|
|
3
|
-
"Ruby is a dynamic, open source programming language with a focus
|
|
4
|
-
on simplicity and productivity. It has an elegant syntax that is
|
|
5
|
-
natural to read and easy to write. Ruby was designed to make
|
|
6
|
-
programmers happy."
|
|
7
|
-
|
|
8
|
-
After calling the tool, report the results in a short summary.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
Use the available tools to answer these questions:
|
|
2
|
-
|
|
3
|
-
1. What is today's date and what day of the week is it?
|
|
4
|
-
2. What operating system and how much memory does this machine have?
|
|
5
|
-
3. What are the DNS MX records for google.com?
|
|
6
|
-
|
|
7
|
-
For each question, call the appropriate tool, then summarize
|
|
8
|
-
the results in a short sentence.
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
# TaskFlow — Project & Task Management Web Application
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
Build a standalone Ruby application using Sinatra as the web framework.
|
|
6
|
-
TaskFlow is a multi-user project and task management system similar to a
|
|
7
|
-
simplified Trello or Asana. The application must be a single deployable
|
|
8
|
-
Ruby process with no external service dependencies beyond SQLite.
|
|
9
|
-
|
|
10
|
-
## Technology Stack
|
|
11
|
-
|
|
12
|
-
- Ruby 3.x
|
|
13
|
-
- Sinatra 4.x (classic style, single `app.rb` entry point)
|
|
14
|
-
- SQLite via the Sequel ORM (migrations in `db/migrations/`)
|
|
15
|
-
- ERB templates in `views/` (layouts, partials)
|
|
16
|
-
- Bootstrap 5 via CDN for styling
|
|
17
|
-
- bcrypt for password hashing
|
|
18
|
-
- jwt gem for API token issuance
|
|
19
|
-
- Rack::Session::Cookie for browser sessions
|
|
20
|
-
- WEBrick for development; Puma for production
|
|
21
|
-
|
|
22
|
-
## Authentication & Authorization
|
|
23
|
-
|
|
24
|
-
- Users register with email, password (bcrypt), and display name
|
|
25
|
-
- Login issues a session cookie (browser) and a JWT (API clients)
|
|
26
|
-
- Passwords must be at least 8 characters; emails must be unique
|
|
27
|
-
- Sessions expire after 24 hours; JWT tokens after 1 hour
|
|
28
|
-
- Route protection: unauthenticated requests redirect to /login (browser)
|
|
29
|
-
or return 401 JSON (API requests with Accept: application/json)
|
|
30
|
-
- Role system: each project has members with role `owner`, `editor`, or `viewer`
|
|
31
|
-
- Only owners may delete a project or change member roles
|
|
32
|
-
- Editors may create/update/delete tasks within the project
|
|
33
|
-
- Viewers may only read
|
|
34
|
-
|
|
35
|
-
## Data Model
|
|
36
|
-
|
|
37
|
-
### User
|
|
38
|
-
- id (integer, primary key)
|
|
39
|
-
- email (string, unique, not null)
|
|
40
|
-
- password_digest (string, not null)
|
|
41
|
-
- display_name (string, not null)
|
|
42
|
-
- created_at, updated_at (timestamps)
|
|
43
|
-
|
|
44
|
-
### Project
|
|
45
|
-
- id (integer, primary key)
|
|
46
|
-
- name (string, not null)
|
|
47
|
-
- description (text)
|
|
48
|
-
- owner_id (integer, FK → users.id)
|
|
49
|
-
- created_at, updated_at
|
|
50
|
-
|
|
51
|
-
### ProjectMember
|
|
52
|
-
- id (integer, primary key)
|
|
53
|
-
- project_id (integer, FK → projects.id)
|
|
54
|
-
- user_id (integer, FK → users.id)
|
|
55
|
-
- role (string: 'owner' | 'editor' | 'viewer')
|
|
56
|
-
- joined_at (timestamp)
|
|
57
|
-
- UNIQUE constraint on (project_id, user_id)
|
|
58
|
-
|
|
59
|
-
### Task
|
|
60
|
-
- id (integer, primary key)
|
|
61
|
-
- project_id (integer, FK → projects.id)
|
|
62
|
-
- title (string, not null)
|
|
63
|
-
- description (text)
|
|
64
|
-
- status (string: 'todo' | 'in_progress' | 'done', default 'todo')
|
|
65
|
-
- priority (string: 'low' | 'medium' | 'high', default 'medium')
|
|
66
|
-
- assigned_to (integer, FK → users.id, nullable)
|
|
67
|
-
- due_date (date, nullable)
|
|
68
|
-
- created_by (integer, FK → users.id)
|
|
69
|
-
- created_at, updated_at
|
|
70
|
-
|
|
71
|
-
## Web Routes (Browser)
|
|
72
|
-
|
|
73
|
-
- GET / → redirect to /dashboard if logged in, else /login
|
|
74
|
-
- GET /login → login form
|
|
75
|
-
- POST /login → authenticate, set session, redirect to /dashboard
|
|
76
|
-
- GET /register → registration form
|
|
77
|
-
- POST /register → create user, auto-login, redirect to /dashboard
|
|
78
|
-
- POST /logout → clear session, redirect to /login
|
|
79
|
-
- GET /dashboard → list all projects the current user is a member of
|
|
80
|
-
- GET /projects/new → form to create a project
|
|
81
|
-
- POST /projects → create project, add user as owner
|
|
82
|
-
- GET /projects/:id → project detail: task list, member list
|
|
83
|
-
- GET /projects/:id/edit → edit project name/description
|
|
84
|
-
- PUT /projects/:id → update project
|
|
85
|
-
- DELETE /projects/:id → delete project (owner only)
|
|
86
|
-
- GET /projects/:id/tasks/new → new task form
|
|
87
|
-
- POST /projects/:id/tasks → create task
|
|
88
|
-
- GET /projects/:id/tasks/:tid/edit → edit task form
|
|
89
|
-
- PUT /projects/:id/tasks/:tid → update task
|
|
90
|
-
- DELETE /projects/:id/tasks/:tid → delete task
|
|
91
|
-
|
|
92
|
-
## REST API Routes (JSON, prefix /api/v1)
|
|
93
|
-
|
|
94
|
-
- POST /api/v1/auth/login → { token: "jwt..." }
|
|
95
|
-
- GET /api/v1/projects → array of projects for current user
|
|
96
|
-
- POST /api/v1/projects → create project
|
|
97
|
-
- GET /api/v1/projects/:id → project + tasks
|
|
98
|
-
- PUT /api/v1/projects/:id → update project
|
|
99
|
-
- DELETE /api/v1/projects/:id → delete project
|
|
100
|
-
- GET /api/v1/projects/:id/tasks → task list
|
|
101
|
-
- POST /api/v1/projects/:id/tasks → create task
|
|
102
|
-
- PUT /api/v1/projects/:id/tasks/:tid → update task
|
|
103
|
-
- DELETE /api/v1/projects/:id/tasks/:tid → delete task
|
|
104
|
-
- GET /api/v1/projects/:id/members → member list
|
|
105
|
-
- POST /api/v1/projects/:id/members → add member
|
|
106
|
-
- DELETE /api/v1/projects/:id/members/:uid → remove member
|
|
107
|
-
|
|
108
|
-
## Views (ERB)
|
|
109
|
-
|
|
110
|
-
- layout.erb → HTML shell, nav bar, flash messages, Bootstrap 5
|
|
111
|
-
- dashboard.erb → project cards grid, "New Project" button
|
|
112
|
-
- projects/show.erb → task board (Kanban columns by status), member sidebar
|
|
113
|
-
- projects/form.erb → shared create/edit form
|
|
114
|
-
- tasks/form.erb → shared create/edit form
|
|
115
|
-
- auth/login.erb → login form
|
|
116
|
-
- auth/register.erb → registration form
|
|
117
|
-
- partials/_flash.erb → flash message component
|
|
118
|
-
- partials/_task_card.erb → task card with status badge and priority indicator
|
|
119
|
-
|
|
120
|
-
## Infrastructure & Configuration
|
|
121
|
-
|
|
122
|
-
- `app.rb` → Sinatra application class, requires all components
|
|
123
|
-
- `config.ru` → Rack entry point, mounts the app
|
|
124
|
-
- `Gemfile` → all dependencies with locked versions
|
|
125
|
-
- `db/migrations/` → numbered Sequel migration files
|
|
126
|
-
- `db/schema.rb` → auto-generated schema dump
|
|
127
|
-
- `lib/auth_helpers.rb` → session/JWT helpers, `current_user`, `require_login`
|
|
128
|
-
- `lib/api_helpers.rb` → JSON response helpers, token verification
|
|
129
|
-
- `config/database.rb` → Sequel connection setup (dev/test/prod environments)
|
|
130
|
-
- `config/settings.rb` → app constants: session secret, JWT secret, token TTL
|
|
131
|
-
- `.env.example` → template for required environment variables
|
|
132
|
-
|
|
133
|
-
## Testing
|
|
134
|
-
|
|
135
|
-
- RSpec with rack-test for request specs
|
|
136
|
-
- Factory pattern for test data (no FactoryBot, plain Ruby factory methods)
|
|
137
|
-
- Tests in `spec/`: `spec/auth_spec.rb`, `spec/projects_spec.rb`,
|
|
138
|
-
`spec/tasks_spec.rb`, `spec/api_spec.rb`
|
|
139
|
-
- Test database: separate SQLite file, schema reset before each suite
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# examples/rules/01_classify_ruby.rb
|
|
2
|
-
#
|
|
3
|
-
# Custom classification rule: detect Ruby-specific requests.
|
|
4
|
-
#
|
|
5
|
-
# Install: cp examples/rules/01_classify_ruby.rb ~/.config/aia/rules/
|
|
6
|
-
|
|
7
|
-
AIA.rules_for(:classify) do
|
|
8
|
-
rule "ruby_request" do
|
|
9
|
-
on :turn_input do
|
|
10
|
-
text matches(/\b(ruby|rails|gem|bundler|rake|rspec|minitest|rubocop|sorbet)\b/i)
|
|
11
|
-
end
|
|
12
|
-
perform do |_facts|
|
|
13
|
-
AIA.decisions.add(:classification, domain: "code", subdomain: "ruby", source: "user_ruby_request")
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# examples/rules/02_prefer_claude_for_code.rb
|
|
2
|
-
#
|
|
3
|
-
# Model selection rule: prefer Claude for code tasks.
|
|
4
|
-
# When the classify KB tags a prompt as "code" domain,
|
|
5
|
-
# suggest Claude as the preferred model.
|
|
6
|
-
#
|
|
7
|
-
# Install: cp examples/rules/02_prefer_claude_for_code.rb ~/.config/aia/rules/
|
|
8
|
-
|
|
9
|
-
AIA.rules_for(:model_select) do
|
|
10
|
-
rule "prefer_claude_for_code" do
|
|
11
|
-
on :classification_decision, domain: "code"
|
|
12
|
-
on :model, name: satisfies { |n| n.to_s.include?("claude") }
|
|
13
|
-
perform do |facts|
|
|
14
|
-
AIA.decisions.add(:model_decision,
|
|
15
|
-
model: facts[1][:name],
|
|
16
|
-
reason: "user rule: prefer Claude for code tasks")
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# examples/rules/03_gate_prompt_length.rb
|
|
2
|
-
#
|
|
3
|
-
# Quality gate rule: warn when context files are very large.
|
|
4
|
-
# This supplements the built-in 100KB warning with a custom threshold.
|
|
5
|
-
#
|
|
6
|
-
# Install: cp examples/rules/03_gate_prompt_length.rb ~/.config/aia/rules/
|
|
7
|
-
|
|
8
|
-
AIA.rules_for(:gate) do
|
|
9
|
-
rule "very_large_context_warning" do
|
|
10
|
-
on :context_stats, large: true
|
|
11
|
-
perform do |facts|
|
|
12
|
-
size = facts[0][:total_size]
|
|
13
|
-
if size && size > 500_000
|
|
14
|
-
AIA.decisions.add(:gate, action: "warn",
|
|
15
|
-
message: "Context exceeds 500KB (#{size / 1024}KB). This may be slow and expensive.")
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# examples/rules/04_tool_selection.rb
|
|
2
|
-
#
|
|
3
|
-
# Custom tool selection rules (optional).
|
|
4
|
-
#
|
|
5
|
-
# AIA automatically builds tool routing rules at startup by analyzing
|
|
6
|
-
# each loaded tool's name and description against domain keyword patterns.
|
|
7
|
-
# This file shows how to ADD custom rules on top of the automatic ones.
|
|
8
|
-
#
|
|
9
|
-
# Use cases for custom rules:
|
|
10
|
-
# - Override automatic classification for a specific tool
|
|
11
|
-
# - Add domain routing for a custom tool with unusual naming
|
|
12
|
-
# - Activate tools based on input text patterns instead of domain
|
|
13
|
-
#
|
|
14
|
-
# Install: cp examples/rules/04_tool_selection.rb ~/.config/aia/rules/
|
|
15
|
-
#
|
|
16
|
-
# Facts available in the :route KB:
|
|
17
|
-
# :tool — name: String, description: String, active: true
|
|
18
|
-
# :classification_decision — domain: String, ...
|
|
19
|
-
# :turn_input — text: String, length: Integer
|
|
20
|
-
|
|
21
|
-
AIA.rules_for(:route) do
|
|
22
|
-
# Example: activate a custom tool for a specific keyword
|
|
23
|
-
# rule "activate_my_custom_tool" do
|
|
24
|
-
# on :turn_input do
|
|
25
|
-
# text matches(/\b(my_keyword)\b/i)
|
|
26
|
-
# end
|
|
27
|
-
# on :tool, name: "my_custom_tool"
|
|
28
|
-
# perform do |facts|
|
|
29
|
-
# AIA.decisions.add(:tool_activate, tool: facts[1][:name], reason: "custom keyword match")
|
|
30
|
-
# end
|
|
31
|
-
# end
|
|
32
|
-
|
|
33
|
-
# Example: force a tool into a domain it wasn't auto-classified into
|
|
34
|
-
# rule "activate_special_tool_for_data" do
|
|
35
|
-
# on :classification_decision, domain: "data"
|
|
36
|
-
# on :tool, name: "my_special_tool"
|
|
37
|
-
# perform do |facts|
|
|
38
|
-
# AIA.decisions.add(:tool_activate, tool: facts[1][:name], reason: "custom data domain override")
|
|
39
|
-
# end
|
|
40
|
-
# end
|
|
41
|
-
end
|
data/examples/rules/README.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# AIA User Rules
|
|
2
|
-
|
|
3
|
-
> **NOTE (2026-03-28)**: The KBS rule engine has been removed from AIA (see ADR-010).
|
|
4
|
-
> This directory is preserved for historical reference only. The `.rb` example files
|
|
5
|
-
> here no longer work. User-defined rule hooks (`~/.config/aia/rules/*.rb`) are no
|
|
6
|
-
> longer supported. Tool filtering is now handled exclusively by the TF-IDF/vector
|
|
7
|
-
> strategies (A=TF-IDF, B=Zvec, C=SqliteVec, D=LSI).
|
|
8
|
-
|
|
9
|
-
User rules extended the built-in KBS rule engine with custom classification,
|
|
10
|
-
model selection, MCP routing, quality gate, and learning rules.
|
|
11
|
-
|
|
12
|
-
## Setup
|
|
13
|
-
|
|
14
|
-
Place `.rb` files in `~/.config/aia/rules/`. AIA loads them alphabetically
|
|
15
|
-
at startup. Each file calls `AIA.rules_for(:kb_name)` to register rules
|
|
16
|
-
targeting a specific knowledge base.
|
|
17
|
-
|
|
18
|
-
## Available Knowledge Bases
|
|
19
|
-
|
|
20
|
-
| KB Name | Purpose | Facts Available |
|
|
21
|
-
|----------------|--------------------------------------|--------------------------------|
|
|
22
|
-
| `:classify` | Categorize prompts by domain/intent | `:turn_input`, `:context_file` |
|
|
23
|
-
| `:model_select`| Choose model based on classification | `:classification_decision`, `:model` |
|
|
24
|
-
| `:route` | Activate MCP servers | `:classification_decision`, `:mcp_server` |
|
|
25
|
-
| `:gate` | Pre-send quality checks | `:turn_input`, `:context_stats`, `:session_stats` |
|
|
26
|
-
| `:learn` | Post-response tracking | `:response_outcome`, `:session_stats` |
|
|
27
|
-
|
|
28
|
-
## Examples
|
|
29
|
-
|
|
30
|
-
See the `.rb` files in this directory for working examples.
|