claraity-code 0.11.0__tar.gz
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.
- claraity_code-0.11.0/PKG-INFO +816 -0
- claraity_code-0.11.0/README.md +755 -0
- claraity_code-0.11.0/claraity_code.egg-info/PKG-INFO +816 -0
- claraity_code-0.11.0/claraity_code.egg-info/SOURCES.txt +273 -0
- claraity_code-0.11.0/claraity_code.egg-info/dependency_links.txt +1 -0
- claraity_code-0.11.0/claraity_code.egg-info/entry_points.txt +2 -0
- claraity_code-0.11.0/claraity_code.egg-info/requires.txt +49 -0
- claraity_code-0.11.0/claraity_code.egg-info/top_level.txt +1 -0
- claraity_code-0.11.0/pyproject.toml +168 -0
- claraity_code-0.11.0/setup.cfg +4 -0
- claraity_code-0.11.0/src/__init__.py +11 -0
- claraity_code-0.11.0/src/clarity/__init__.py +42 -0
- claraity_code-0.11.0/src/clarity/analyzer/__init__.py +11 -0
- claraity_code-0.11.0/src/clarity/analyzer/code_analyzer.py +543 -0
- claraity_code-0.11.0/src/clarity/analyzer/design_decision_extractor.py +305 -0
- claraity_code-0.11.0/src/clarity/analyzer/usage_analyzer.py +462 -0
- claraity_code-0.11.0/src/clarity/api/__init__.py +10 -0
- claraity_code-0.11.0/src/clarity/api/endpoints.py +760 -0
- claraity_code-0.11.0/src/clarity/api/main.py +502 -0
- claraity_code-0.11.0/src/clarity/api/server.py +307 -0
- claraity_code-0.11.0/src/clarity/api/state.py +227 -0
- claraity_code-0.11.0/src/clarity/api/websocket.py +380 -0
- claraity_code-0.11.0/src/clarity/config.py +352 -0
- claraity_code-0.11.0/src/clarity/core/__init__.py +7 -0
- claraity_code-0.11.0/src/clarity/core/blueprint.py +188 -0
- claraity_code-0.11.0/src/clarity/core/database/__init__.py +9 -0
- claraity_code-0.11.0/src/clarity/core/database/clarity_db.py +905 -0
- claraity_code-0.11.0/src/clarity/core/generator.py +355 -0
- claraity_code-0.11.0/src/clarity/core/prompts.py +213 -0
- claraity_code-0.11.0/src/clarity/integration/__init__.py +9 -0
- claraity_code-0.11.0/src/clarity/integration/agent_hook.py +418 -0
- claraity_code-0.11.0/src/clarity/populate_from_codebase.py +286 -0
- claraity_code-0.11.0/src/clarity/sync/__init__.py +23 -0
- claraity_code-0.11.0/src/clarity/sync/change_detector.py +264 -0
- claraity_code-0.11.0/src/clarity/sync/event_bus.py +322 -0
- claraity_code-0.11.0/src/clarity/sync/file_watcher.py +347 -0
- claraity_code-0.11.0/src/clarity/sync/orchestrator.py +394 -0
- claraity_code-0.11.0/src/clarity/ui/approval.py +684 -0
- claraity_code-0.11.0/src/cli.py +1801 -0
- claraity_code-0.11.0/src/code_intelligence/__init__.py +31 -0
- claraity_code-0.11.0/src/code_intelligence/cache.py +314 -0
- claraity_code-0.11.0/src/code_intelligence/config.py +330 -0
- claraity_code-0.11.0/src/code_intelligence/lsp_client_manager.py +997 -0
- claraity_code-0.11.0/src/code_intelligence/lsp_runtime.py +423 -0
- claraity_code-0.11.0/src/code_intelligence/path_utils.py +76 -0
- claraity_code-0.11.0/src/core/__init__.py +73 -0
- claraity_code-0.11.0/src/core/agent.py +4643 -0
- claraity_code-0.11.0/src/core/agent_helpers.py +272 -0
- claraity_code-0.11.0/src/core/agent_interface.py +288 -0
- claraity_code-0.11.0/src/core/attachment.py +311 -0
- claraity_code-0.11.0/src/core/cancel_token.py +30 -0
- claraity_code-0.11.0/src/core/context_builder.py +706 -0
- claraity_code-0.11.0/src/core/error_context.py +187 -0
- claraity_code-0.11.0/src/core/error_recovery.py +381 -0
- claraity_code-0.11.0/src/core/events.py +302 -0
- claraity_code-0.11.0/src/core/file_reference_parser.py +395 -0
- claraity_code-0.11.0/src/core/permission_mode.py +59 -0
- claraity_code-0.11.0/src/core/plan_mode.py +401 -0
- claraity_code-0.11.0/src/core/protocol.py +543 -0
- claraity_code-0.11.0/src/core/render_meta.py +75 -0
- claraity_code-0.11.0/src/core/session_manager.py +459 -0
- claraity_code-0.11.0/src/core/streaming/__init__.py +22 -0
- claraity_code-0.11.0/src/core/streaming/pipeline.py +478 -0
- claraity_code-0.11.0/src/core/streaming/state.py +95 -0
- claraity_code-0.11.0/src/core/tool_status.py +26 -0
- claraity_code-0.11.0/src/director/__init__.py +68 -0
- claraity_code-0.11.0/src/director/adapter.py +210 -0
- claraity_code-0.11.0/src/director/errors.py +31 -0
- claraity_code-0.11.0/src/director/models.py +134 -0
- claraity_code-0.11.0/src/director/phases/__init__.py +11 -0
- claraity_code-0.11.0/src/director/phases/base.py +30 -0
- claraity_code-0.11.0/src/director/phases/plan.py +61 -0
- claraity_code-0.11.0/src/director/phases/understand.py +56 -0
- claraity_code-0.11.0/src/director/prompts.py +351 -0
- claraity_code-0.11.0/src/director/protocol.py +213 -0
- claraity_code-0.11.0/src/director/tools.py +550 -0
- claraity_code-0.11.0/src/execution/__init__.py +20 -0
- claraity_code-0.11.0/src/execution/checkpoint/__init__.py +14 -0
- claraity_code-0.11.0/src/execution/checkpoint/manager.py +466 -0
- claraity_code-0.11.0/src/execution/controller.py +274 -0
- claraity_code-0.11.0/src/hello_world.py +5 -0
- claraity_code-0.11.0/src/hooks/__init__.py +91 -0
- claraity_code-0.11.0/src/hooks/context.py +223 -0
- claraity_code-0.11.0/src/hooks/events.py +142 -0
- claraity_code-0.11.0/src/hooks/manager.py +551 -0
- claraity_code-0.11.0/src/hooks/result.py +128 -0
- claraity_code-0.11.0/src/integrations/__init__.py +1 -0
- claraity_code-0.11.0/src/integrations/jira/__init__.py +6 -0
- claraity_code-0.11.0/src/integrations/jira/connection.py +230 -0
- claraity_code-0.11.0/src/integrations/jira/tools.py +26 -0
- claraity_code-0.11.0/src/integrations/mcp/__init__.py +21 -0
- claraity_code-0.11.0/src/integrations/mcp/adapter.py +165 -0
- claraity_code-0.11.0/src/integrations/mcp/bridge.py +161 -0
- claraity_code-0.11.0/src/integrations/mcp/client.py +472 -0
- claraity_code-0.11.0/src/integrations/mcp/config.py +42 -0
- claraity_code-0.11.0/src/integrations/mcp/manager.py +224 -0
- claraity_code-0.11.0/src/integrations/mcp/policy.py +167 -0
- claraity_code-0.11.0/src/integrations/mcp/registry.py +173 -0
- claraity_code-0.11.0/src/integrations/secrets.py +179 -0
- claraity_code-0.11.0/src/llm/__init__.py +28 -0
- claraity_code-0.11.0/src/llm/base.py +366 -0
- claraity_code-0.11.0/src/llm/config_loader.py +456 -0
- claraity_code-0.11.0/src/llm/credential_store.py +137 -0
- claraity_code-0.11.0/src/llm/failure_handler.py +767 -0
- claraity_code-0.11.0/src/llm/model_config.py +147 -0
- claraity_code-0.11.0/src/llm/ollama_backend.py +207 -0
- claraity_code-0.11.0/src/llm/openai_backend.py +1409 -0
- claraity_code-0.11.0/src/memory/__init__.py +50 -0
- claraity_code-0.11.0/src/memory/compaction/__init__.py +30 -0
- claraity_code-0.11.0/src/memory/compaction/summarizer.py +597 -0
- claraity_code-0.11.0/src/memory/context_injector.py +224 -0
- claraity_code-0.11.0/src/memory/episodic_memory.py +313 -0
- claraity_code-0.11.0/src/memory/file_loader.py +408 -0
- claraity_code-0.11.0/src/memory/memory_manager.py +1439 -0
- claraity_code-0.11.0/src/memory/models.py +137 -0
- claraity_code-0.11.0/src/memory/observation_store.py +596 -0
- claraity_code-0.11.0/src/memory/semantic_memory.py +381 -0
- claraity_code-0.11.0/src/memory/working_memory.py +419 -0
- claraity_code-0.11.0/src/observability/__init__.py +179 -0
- claraity_code-0.11.0/src/observability/error_store.py +502 -0
- claraity_code-0.11.0/src/observability/instrumentation.py +253 -0
- claraity_code-0.11.0/src/observability/langfuse_config.py +260 -0
- claraity_code-0.11.0/src/observability/log_config_loader.py +329 -0
- claraity_code-0.11.0/src/observability/log_query.py +851 -0
- claraity_code-0.11.0/src/observability/log_store.py +553 -0
- claraity_code-0.11.0/src/observability/logging_config.py +981 -0
- claraity_code-0.11.0/src/observability/metrics.py +402 -0
- claraity_code-0.11.0/src/observability/sqlite_error_handler.py +413 -0
- claraity_code-0.11.0/src/observability/sqlite_log_handler.py +346 -0
- claraity_code-0.11.0/src/observability/transcript_logger.py +533 -0
- claraity_code-0.11.0/src/orchestration/__init__.py +89 -0
- claraity_code-0.11.0/src/orchestration/agent_orchestrator.py +250 -0
- claraity_code-0.11.0/src/orchestration/conversation.py +384 -0
- claraity_code-0.11.0/src/orchestration/models.py +133 -0
- claraity_code-0.11.0/src/orchestration/scenario.py +179 -0
- claraity_code-0.11.0/src/orchestration/scenario_runner.py +355 -0
- claraity_code-0.11.0/src/orchestration/scenarios_library.py +284 -0
- claraity_code-0.11.0/src/orchestration/test_basic.py +191 -0
- claraity_code-0.11.0/src/orchestration/test_multiturn.py +381 -0
- claraity_code-0.11.0/src/orchestration/testing_agent.py +413 -0
- claraity_code-0.11.0/src/platform/__init__.py +89 -0
- claraity_code-0.11.0/src/platform/windows.py +610 -0
- claraity_code-0.11.0/src/prompts/__init__.py +17 -0
- claraity_code-0.11.0/src/prompts/enhanced_prompts.py +1387 -0
- claraity_code-0.11.0/src/prompts/native_tools_prompt.py +121 -0
- claraity_code-0.11.0/src/prompts/optimizer.py +259 -0
- claraity_code-0.11.0/src/prompts/subagents/__init__.py +1664 -0
- claraity_code-0.11.0/src/prompts/system_prompts.py +1007 -0
- claraity_code-0.11.0/src/prompts/templates.py +266 -0
- claraity_code-0.11.0/src/rag/__init__.py +25 -0
- claraity_code-0.11.0/src/rag/code_indexer.py +449 -0
- claraity_code-0.11.0/src/rag/embedder.py +201 -0
- claraity_code-0.11.0/src/rag/models.py +105 -0
- claraity_code-0.11.0/src/rag/retriever.py +275 -0
- claraity_code-0.11.0/src/rag/vector_store.py +179 -0
- claraity_code-0.11.0/src/session/__init__.py +154 -0
- claraity_code-0.11.0/src/session/manager/__init__.py +26 -0
- claraity_code-0.11.0/src/session/manager/hydrator.py +346 -0
- claraity_code-0.11.0/src/session/manager/session_manager.py +382 -0
- claraity_code-0.11.0/src/session/models/__init__.py +85 -0
- claraity_code-0.11.0/src/session/models/base.py +76 -0
- claraity_code-0.11.0/src/session/models/message.py +974 -0
- claraity_code-0.11.0/src/session/persistence/__init__.py +52 -0
- claraity_code-0.11.0/src/session/persistence/parser.py +278 -0
- claraity_code-0.11.0/src/session/persistence/writer.py +400 -0
- claraity_code-0.11.0/src/session/providers/__init__.py +20 -0
- claraity_code-0.11.0/src/session/providers/anthropic.py +353 -0
- claraity_code-0.11.0/src/session/providers/openai.py +243 -0
- claraity_code-0.11.0/src/session/store/__init__.py +35 -0
- claraity_code-0.11.0/src/session/store/memory_store.py +928 -0
- claraity_code-0.11.0/src/session/subagent_registry.py +13 -0
- claraity_code-0.11.0/src/subagents/__init__.py +43 -0
- claraity_code-0.11.0/src/subagents/__main__.py +4 -0
- claraity_code-0.11.0/src/subagents/config.py +602 -0
- claraity_code-0.11.0/src/subagents/ipc.py +261 -0
- claraity_code-0.11.0/src/subagents/manager.py +506 -0
- claraity_code-0.11.0/src/subagents/runner.py +279 -0
- claraity_code-0.11.0/src/subagents/subagent.py +843 -0
- claraity_code-0.11.0/src/subagents/sync_writer.py +70 -0
- claraity_code-0.11.0/src/testing/__init__.py +19 -0
- claraity_code-0.11.0/src/testing/models.py +115 -0
- claraity_code-0.11.0/src/testing/test_runner.py +461 -0
- claraity_code-0.11.0/src/testing/validation_engine.py +193 -0
- claraity_code-0.11.0/src/testing/validation_tool.py +200 -0
- claraity_code-0.11.0/src/tools/__init__.py +131 -0
- claraity_code-0.11.0/src/tools/base.py +389 -0
- claraity_code-0.11.0/src/tools/checkpoint_tool.py +151 -0
- claraity_code-0.11.0/src/tools/clarify_tool.py +193 -0
- claraity_code-0.11.0/src/tools/clarity_setup_tool.py +178 -0
- claraity_code-0.11.0/src/tools/clarity_tools.py +2253 -0
- claraity_code-0.11.0/src/tools/code_search.py +189 -0
- claraity_code-0.11.0/src/tools/delegation.py +543 -0
- claraity_code-0.11.0/src/tools/file_operations.py +738 -0
- claraity_code-0.11.0/src/tools/git_operations.py +395 -0
- claraity_code-0.11.0/src/tools/knowledge_tools.py +567 -0
- claraity_code-0.11.0/src/tools/lsp_tools.py +654 -0
- claraity_code-0.11.0/src/tools/plan_mode_tools.py +238 -0
- claraity_code-0.11.0/src/tools/planning_tool.py +205 -0
- claraity_code-0.11.0/src/tools/search_tools.py +775 -0
- claraity_code-0.11.0/src/tools/task_state.py +198 -0
- claraity_code-0.11.0/src/tools/tool_parser.py +305 -0
- claraity_code-0.11.0/src/tools/tool_schemas.py +1305 -0
- claraity_code-0.11.0/src/tools/web_tools.py +1161 -0
- claraity_code-0.11.0/src/ui/__init__.py +79 -0
- claraity_code-0.11.0/src/ui/app.py +3865 -0
- claraity_code-0.11.0/src/ui/attachments.py +198 -0
- claraity_code-0.11.0/src/ui/autocomplete.py +271 -0
- claraity_code-0.11.0/src/ui/chat_interface.py +650 -0
- claraity_code-0.11.0/src/ui/clipboard_handler.py +194 -0
- claraity_code-0.11.0/src/ui/events.py +36 -0
- claraity_code-0.11.0/src/ui/formatters.py +700 -0
- claraity_code-0.11.0/src/ui/jira_config_screen.py +381 -0
- claraity_code-0.11.0/src/ui/llm_config_screen.py +476 -0
- claraity_code-0.11.0/src/ui/messages.py +143 -0
- claraity_code-0.11.0/src/ui/protocol.py +32 -0
- claraity_code-0.11.0/src/ui/session_picker.py +325 -0
- claraity_code-0.11.0/src/ui/store_adapter.py +540 -0
- claraity_code-0.11.0/src/ui/subagent_registry.py +323 -0
- claraity_code-0.11.0/src/ui/widgets/__init__.py +47 -0
- claraity_code-0.11.0/src/ui/widgets/attachment_bar.py +249 -0
- claraity_code-0.11.0/src/ui/widgets/autocomplete_dropdown.py +188 -0
- claraity_code-0.11.0/src/ui/widgets/clarify_widget.py +629 -0
- claraity_code-0.11.0/src/ui/widgets/code_block.py +167 -0
- claraity_code-0.11.0/src/ui/widgets/diff_widget.py +316 -0
- claraity_code-0.11.0/src/ui/widgets/message.py +1143 -0
- claraity_code-0.11.0/src/ui/widgets/pause_widget.py +190 -0
- claraity_code-0.11.0/src/ui/widgets/plan_approval_widget.py +326 -0
- claraity_code-0.11.0/src/ui/widgets/status_bar.py +612 -0
- claraity_code-0.11.0/src/ui/widgets/subagent_card.py +618 -0
- claraity_code-0.11.0/src/ui/widgets/thinking.py +237 -0
- claraity_code-0.11.0/src/ui/widgets/todo_bar.py +105 -0
- claraity_code-0.11.0/src/ui/widgets/tool_card.py +990 -0
- claraity_code-0.11.0/src/utils/hello_world.py +6 -0
- claraity_code-0.11.0/src/validation/__init__.py +39 -0
- claraity_code-0.11.0/src/validation/judge.py +497 -0
- claraity_code-0.11.0/src/validation/orchestrator.py +838 -0
- claraity_code-0.11.0/src/validation/report_generator.py +264 -0
- claraity_code-0.11.0/src/validation/run.py +13 -0
- claraity_code-0.11.0/src/validation/runner.py +361 -0
- claraity_code-0.11.0/src/validation/scenario.py +276 -0
- claraity_code-0.11.0/src/validation/scenarios.py +433 -0
- claraity_code-0.11.0/tests/test_agent_interface.py +553 -0
- claraity_code-0.11.0/tests/test_basic_functionality.py +5 -0
- claraity_code-0.11.0/tests/test_checkpoint_manager.py +454 -0
- claraity_code-0.11.0/tests/test_code_intelligence_config.py +423 -0
- claraity_code-0.11.0/tests/test_context_assembly_report.py +245 -0
- claraity_code-0.11.0/tests/test_demo.py +108 -0
- claraity_code-0.11.0/tests/test_e2e_session_persistence.py +538 -0
- claraity_code-0.11.0/tests/test_e2e_verification.py +549 -0
- claraity_code-0.11.0/tests/test_error_classification.py +229 -0
- claraity_code-0.11.0/tests/test_error_recovery.py +193 -0
- claraity_code-0.11.0/tests/test_example.py +8 -0
- claraity_code-0.11.0/tests/test_feature.py +9 -0
- claraity_code-0.11.0/tests/test_file_reference_parser.py +415 -0
- claraity_code-0.11.0/tests/test_headroom_guard.py +266 -0
- claraity_code-0.11.0/tests/test_hello_world.py +10 -0
- claraity_code-0.11.0/tests/test_llm_failure_handler.py +825 -0
- claraity_code-0.11.0/tests/test_long_running_controller.py +192 -0
- claraity_code-0.11.0/tests/test_lsp_cache.py +663 -0
- claraity_code-0.11.0/tests/test_lsp_client_manager.py +518 -0
- claraity_code-0.11.0/tests/test_lsp_tools.py +648 -0
- claraity_code-0.11.0/tests/test_memory_observation_integration.py +227 -0
- claraity_code-0.11.0/tests/test_observation_store.py +381 -0
- claraity_code-0.11.0/tests/test_orchestration_basic.py +923 -0
- claraity_code-0.11.0/tests/test_permission_modes.py +339 -0
- claraity_code-0.11.0/tests/test_platform_windows.py +345 -0
- claraity_code-0.11.0/tests/test_prompt.py +9 -0
- claraity_code-0.11.0/tests/test_sample_functionality.py +9 -0
- claraity_code-0.11.0/tests/test_search_tools.py +727 -0
- claraity_code-0.11.0/tests/test_simple.py +5 -0
- claraity_code-0.11.0/tests/test_transcript_logger.py +457 -0
- claraity_code-0.11.0/tests/test_usage_analyzer.py +457 -0
- claraity_code-0.11.0/tests/test_validation_framework.py +245 -0
- claraity_code-0.11.0/tests/test_web_tools.py +739 -0
- claraity_code-0.11.0/tests/test_windows_integration.py +174 -0
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claraity-code
|
|
3
|
+
Version: 0.11.0
|
|
4
|
+
Summary: ClarAIty Code - An AI-powered coding agent with TUI interface, tool execution, multi-layered memory, prompt caching, and intelligent context management
|
|
5
|
+
Author: Vijay Jayanandan
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: ai,coding-agent,llm,tui,context-management,prompt-caching,tool-use
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: transformers>=4.40.0
|
|
17
|
+
Requires-Dist: sentence-transformers>=2.7.0
|
|
18
|
+
Requires-Dist: chromadb>=0.4.24
|
|
19
|
+
Requires-Dist: langchain>=0.2.0
|
|
20
|
+
Requires-Dist: langchain-community>=0.2.0
|
|
21
|
+
Requires-Dist: tiktoken>=0.7.0
|
|
22
|
+
Requires-Dist: tree-sitter>=0.21.0
|
|
23
|
+
Requires-Dist: tree-sitter-languages>=1.10.2
|
|
24
|
+
Requires-Dist: pydantic>=2.7.0
|
|
25
|
+
Requires-Dist: pydantic-settings>=2.2.0
|
|
26
|
+
Requires-Dist: fastapi>=0.111.0
|
|
27
|
+
Requires-Dist: uvicorn>=0.29.0
|
|
28
|
+
Requires-Dist: httpx>=0.27.0
|
|
29
|
+
Requires-Dist: aiofiles>=23.2.1
|
|
30
|
+
Requires-Dist: redis>=5.0.0
|
|
31
|
+
Requires-Dist: sqlalchemy>=2.0.30
|
|
32
|
+
Requires-Dist: alembic>=1.13.0
|
|
33
|
+
Requires-Dist: rich>=13.7.0
|
|
34
|
+
Requires-Dist: typer>=0.12.0
|
|
35
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
36
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
37
|
+
Requires-Dist: jinja2>=3.1.4
|
|
38
|
+
Requires-Dist: gitpython>=3.1.43
|
|
39
|
+
Requires-Dist: watchdog>=4.0.0
|
|
40
|
+
Requires-Dist: psutil>=5.9.8
|
|
41
|
+
Requires-Dist: textual>=0.47.0
|
|
42
|
+
Requires-Dist: structlog>=24.1.0
|
|
43
|
+
Requires-Dist: openai>=1.12.0
|
|
44
|
+
Requires-Dist: pyperclip>=1.8.0
|
|
45
|
+
Requires-Dist: Pillow>=10.0.0
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: pytest>=8.2.0; extra == "dev"
|
|
48
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
50
|
+
Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
|
|
51
|
+
Requires-Dist: black>=24.4.0; extra == "dev"
|
|
52
|
+
Requires-Dist: ruff>=0.4.0; extra == "dev"
|
|
53
|
+
Requires-Dist: mypy>=1.10.0; extra == "dev"
|
|
54
|
+
Requires-Dist: pre-commit>=3.7.0; extra == "dev"
|
|
55
|
+
Provides-Extra: ollama
|
|
56
|
+
Requires-Dist: ollama>=0.2.0; extra == "ollama"
|
|
57
|
+
Provides-Extra: vllm
|
|
58
|
+
Requires-Dist: vllm>=0.4.0; extra == "vllm"
|
|
59
|
+
Provides-Extra: all
|
|
60
|
+
Requires-Dist: ai-coding-agent[dev,ollama,vllm]; extra == "all"
|
|
61
|
+
|
|
62
|
+
# AI Coding Agent
|
|
63
|
+
|
|
64
|
+
An advanced AI coding agent optimized for small open-source LLMs, featuring state-of-the-art memory management, RAG-powered code understanding, and intelligent prompt engineering. Designed for organizations with strict data residency requirements that need self-hosted AI solutions.
|
|
65
|
+
|
|
66
|
+
**🚀 GPU-Accelerated | 🔒 Privacy-First | 🎯 Production-Ready**
|
|
67
|
+
|
|
68
|
+
## ✨ Key Features
|
|
69
|
+
|
|
70
|
+
### Core Capabilities
|
|
71
|
+
- **Intelligent Workflow Orchestration**: Plan-Execute-Verify system that automatically decides when to use structured workflows vs direct execution
|
|
72
|
+
- **Multi-Layered Memory System**: Hierarchical memory architecture (working, episodic, semantic) to overcome context window limitations
|
|
73
|
+
- **File-Based Hierarchical Memory**: Team-shareable, version-controlled memory system with 4-level hierarchy (enterprise → user → project → imports) for persistent coding standards and preferences
|
|
74
|
+
- **RAG-Powered Code Understanding**: Hybrid search combining semantic and keyword-based retrieval with AST-based code parsing
|
|
75
|
+
- **Advanced Context Management**: Dynamic context assembly with intelligent prioritization and compression
|
|
76
|
+
- **Optimized Prompt Engineering**: Task-specific templates with few-shot examples and chain-of-thought reasoning
|
|
77
|
+
- **Multi-LLM Backend Support**: Compatible with OpenAI, Alibaba Cloud, Ollama, and any OpenAI-compatible API
|
|
78
|
+
- **Privacy-First Design**: Complete local execution option with zero external data transmission
|
|
79
|
+
|
|
80
|
+
### Workflow Features (NEW!)
|
|
81
|
+
- **Task Analysis**: Automatically classifies tasks (9 types, 5 complexity levels) and estimates resource requirements
|
|
82
|
+
- **Intelligent Planning**: LLM-powered execution plan generation with dependency validation
|
|
83
|
+
- **Step-by-Step Execution**: Direct tool execution with real-time progress tracking and error recovery
|
|
84
|
+
- **Decision Logic**: Smart routing between workflow and direct execution based on task type and complexity
|
|
85
|
+
- **User Approval Gates**: Interactive approval for high-risk operations with detailed risk assessment
|
|
86
|
+
- **Progress Transparency**: Real-time callbacks showing what the agent is doing at each step
|
|
87
|
+
|
|
88
|
+
### Advanced Features
|
|
89
|
+
- **AST-Based Code Analysis**: Deep understanding of code structure using Tree-sitter parsers for 10+ languages
|
|
90
|
+
- **Incremental Codebase Learning**: Progressive understanding without overwhelming small context windows
|
|
91
|
+
- **Token Budget Management**: Dynamic allocation of context budget based on task requirements
|
|
92
|
+
- **Session Persistence**: Save and restore conversation state across sessions
|
|
93
|
+
- **Checkpoints for Long-Running Projects**: Create save points during multi-day development with full context preservation
|
|
94
|
+
- **Tool Execution Engine**: Read, write, edit, search, and analyze code intelligently
|
|
95
|
+
|
|
96
|
+
### Language Support
|
|
97
|
+
- **Python** ✅ (fully tested)
|
|
98
|
+
- **Java / Spring Boot** ✅ (parser verified)
|
|
99
|
+
- **TypeScript / React / TSX** ✅ (parser verified)
|
|
100
|
+
- Plus: JavaScript, Go, Rust, C/C++, C#, Ruby, PHP
|
|
101
|
+
|
|
102
|
+
## 🏗️ Architecture
|
|
103
|
+
|
|
104
|
+
The agent uses a sophisticated multi-component architecture:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
┌─────────────────────────────────────────────────────────┐
|
|
108
|
+
│ Coding Agent │
|
|
109
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
110
|
+
│ │ Memory │ │ RAG │ │ Prompts │ │
|
|
111
|
+
│ │ Manager │ │ System │ │ Optimizer │ │
|
|
112
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
113
|
+
│ │ │ │ │
|
|
114
|
+
│ └────────────────┴─────────────────┘ │
|
|
115
|
+
│ │ │
|
|
116
|
+
│ ┌───────▼────────┐ │
|
|
117
|
+
│ │ LLM Backend │ │
|
|
118
|
+
│ │ (Ollama/vLLM) │ │
|
|
119
|
+
│ └────────────────┘ │
|
|
120
|
+
└─────────────────────────────────────────────────────────┘
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**See [ARCHITECTURE.md](ARCHITECTURE.md)** for detailed system design.
|
|
124
|
+
|
|
125
|
+
## 🚀 Quick Start
|
|
126
|
+
|
|
127
|
+
### Prerequisites
|
|
128
|
+
- Python 3.10+ (3.11 recommended)
|
|
129
|
+
- 8GB+ RAM (16GB+ recommended)
|
|
130
|
+
- GPU optional but highly recommended (10-30x performance improvement)
|
|
131
|
+
- Local LLM backend (Ollama recommended)
|
|
132
|
+
|
|
133
|
+
### Installation
|
|
134
|
+
|
|
135
|
+
1. **Clone the repository**
|
|
136
|
+
```bash
|
|
137
|
+
git clone https://github.com/vijayjayanandan/ai-coding-agent.git
|
|
138
|
+
cd ai-coding-agent
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
2. **Create virtual environment**
|
|
142
|
+
```bash
|
|
143
|
+
python -m venv venv
|
|
144
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
3. **Install dependencies**
|
|
148
|
+
```bash
|
|
149
|
+
pip install -r requirements.txt
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
4. **Set up environment variables**
|
|
153
|
+
```bash
|
|
154
|
+
cp .env.example .env
|
|
155
|
+
# Edit .env with your configuration
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Setting Up LLM Backend
|
|
159
|
+
|
|
160
|
+
#### Option 1: Ollama (Recommended)
|
|
161
|
+
```bash
|
|
162
|
+
# Install Ollama from https://ollama.ai
|
|
163
|
+
# Pull a code-optimized model
|
|
164
|
+
ollama pull deepseek-coder:6.7b-instruct
|
|
165
|
+
# Or try: codellama:7b-instruct, qwen2.5-coder:7b
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### Option 2: GPU-Accelerated with RunPod (Production)
|
|
169
|
+
For 10-30x faster performance, deploy on RunPod with GPU:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# See RUNPOD_QUICKSTART.md for detailed setup
|
|
173
|
+
# Quick summary:
|
|
174
|
+
# 1. Create RunPod account + SSH key
|
|
175
|
+
# 2. Deploy RTX 4090 pod (~$0.69/hour)
|
|
176
|
+
# 3. Run automated setup script
|
|
177
|
+
# 4. Get 1-3 second responses instead of 30-60 seconds!
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Performance Comparison:**
|
|
181
|
+
- CPU (local): 30-60 seconds per query
|
|
182
|
+
- GPU (RunPod RTX 4090): 1-5 seconds per query
|
|
183
|
+
|
|
184
|
+
See [RUNPOD_QUICKSTART.md](RUNPOD_QUICKSTART.md) for step-by-step GPU deployment.
|
|
185
|
+
|
|
186
|
+
### Usage
|
|
187
|
+
|
|
188
|
+
#### Command Line Interface
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Interactive chat mode
|
|
192
|
+
python -m src.cli chat
|
|
193
|
+
|
|
194
|
+
# Execute a single task
|
|
195
|
+
python -m src.cli task "Explain the memory system" --type explain
|
|
196
|
+
|
|
197
|
+
# Index a codebase
|
|
198
|
+
python -m src.cli index ./src
|
|
199
|
+
|
|
200
|
+
# Run demo
|
|
201
|
+
python demo.py
|
|
202
|
+
|
|
203
|
+
# Run capability tests
|
|
204
|
+
python test_agent_capabilities.py
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Memory Management Commands (in chat mode):**
|
|
208
|
+
```bash
|
|
209
|
+
# Show current file-based memories
|
|
210
|
+
> memory
|
|
211
|
+
|
|
212
|
+
# Initialize project memory template
|
|
213
|
+
> memory-init
|
|
214
|
+
|
|
215
|
+
# Quick add a memory (e.g., coding standard)
|
|
216
|
+
> memory-add "Always use 2-space indentation"
|
|
217
|
+
|
|
218
|
+
# Reload memories after editing the file
|
|
219
|
+
> memory-reload
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**File-Based Memory Hierarchy:**
|
|
223
|
+
- **Enterprise** (`/etc/opencodeagent/memory.md` or `C:/ProgramData/opencodeagent/`): Organization-wide policies
|
|
224
|
+
- **User** (`~/.opencodeagent/memory.md`): Personal preferences across all projects
|
|
225
|
+
- **Project** (`./.opencodeagent/memory.md`): Project-specific standards (version controlled)
|
|
226
|
+
- **Imports** (`@path/to/file.md`): Modular memory files with circular detection
|
|
227
|
+
|
|
228
|
+
**Session Persistence Commands (in chat mode):**
|
|
229
|
+
```bash
|
|
230
|
+
# Save current session with metadata
|
|
231
|
+
> session-save
|
|
232
|
+
Session name: feature-auth
|
|
233
|
+
Task description: Implementing JWT authentication
|
|
234
|
+
Tags: feature,auth,backend
|
|
235
|
+
|
|
236
|
+
# List all saved sessions
|
|
237
|
+
> sessions
|
|
238
|
+
╭─ Saved Sessions (5 total) ───────────────────────────╮
|
|
239
|
+
│ ID │ Name │ Description │ Msgs │ ... │
|
|
240
|
+
├──────────┼─────────────┼────────────────┼──────┼─────┤
|
|
241
|
+
│ abc12345 │ feature-auth│ JWT auth... │ 42 │ 2h │
|
|
242
|
+
╰───────────────────────────────────────────────────────╯
|
|
243
|
+
|
|
244
|
+
# Load a saved session (by ID, short ID, or name)
|
|
245
|
+
> session-load abc12345
|
|
246
|
+
✓ Session loaded! 42 messages restored
|
|
247
|
+
|
|
248
|
+
# Show detailed session info
|
|
249
|
+
> session-info feature-auth
|
|
250
|
+
|
|
251
|
+
# Delete old sessions
|
|
252
|
+
> session-delete old-test-session
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Session Persistence Features:**
|
|
256
|
+
- **Complete State Preservation**: Saves all messages, task context, episodic memory, and file memories
|
|
257
|
+
- **Fast Session Listing**: Instant listing even with 100+ sessions using manifest-based indexing
|
|
258
|
+
- **Flexible Loading**: Load by full UUID, 8-char short ID, or human-readable name
|
|
259
|
+
- **Tag-Based Organization**: Organize sessions with tags (e.g., `feature`, `bugfix`, `auth`)
|
|
260
|
+
- **Interactive Prompts**: User-friendly CLI guides you through save process
|
|
261
|
+
- **Safe Operations**: Confirmation prompts prevent accidental data loss
|
|
262
|
+
|
|
263
|
+
**Common Use Cases:**
|
|
264
|
+
- Pause work on a feature and resume later with full context
|
|
265
|
+
- Save before switching between multiple projects
|
|
266
|
+
- Archive completed sessions for future reference
|
|
267
|
+
- Share session IDs with team members for collaboration
|
|
268
|
+
- Organize work by tags (project, feature type, etc.)
|
|
269
|
+
|
|
270
|
+
**Session Storage:**
|
|
271
|
+
Sessions are stored in `.opencodeagent/sessions/` with the following structure:
|
|
272
|
+
```
|
|
273
|
+
.opencodeagent/
|
|
274
|
+
sessions/
|
|
275
|
+
manifest.json # Fast index for listing
|
|
276
|
+
<uuid>/
|
|
277
|
+
metadata.json # Session info (name, tags, timestamps)
|
|
278
|
+
working_memory.json # All messages and context
|
|
279
|
+
episodic_memory.json # Conversation history
|
|
280
|
+
task_context.json # Current task details
|
|
281
|
+
file_memories.txt # Loaded CLAUDE.md content
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Checkpoints for Long-Running Projects
|
|
285
|
+
|
|
286
|
+
**Checkpoints** are work-in-progress snapshots designed for multi-day/multi-session development. Unlike session persistence (which saves complete conversations), checkpoints create save points you can return to later.
|
|
287
|
+
|
|
288
|
+
**Think of it like save games:** Resume development exactly where you left off, with full context of architecture decisions, pending tasks, and conversation history.
|
|
289
|
+
|
|
290
|
+
**CLI Commands (in chat mode):**
|
|
291
|
+
```bash
|
|
292
|
+
# Create a checkpoint during development
|
|
293
|
+
> checkpoint-save
|
|
294
|
+
Description: Backend API complete, frontend pending
|
|
295
|
+
Phase: Phase 1 - API Development
|
|
296
|
+
Pending tasks:
|
|
297
|
+
- Create React dashboard
|
|
298
|
+
- Add authentication UI
|
|
299
|
+
- Implement real-time updates
|
|
300
|
+
✓ Checkpoint created: abc12345
|
|
301
|
+
|
|
302
|
+
# List all checkpoints for current project
|
|
303
|
+
> checkpoints
|
|
304
|
+
╭─ Project Checkpoints (3 total) ──────────────────────╮
|
|
305
|
+
│ ID │ Description │ Files │ Phase │
|
|
306
|
+
├──────────┼────────────────────┼───────┼────────────┤
|
|
307
|
+
│ abc12345 │ Backend API comp...│ 12 │ Phase 1 │
|
|
308
|
+
│ def67890 │ User auth added │ 15 │ Phase 2 │
|
|
309
|
+
╰───────────────────────────────────────────────────────╯
|
|
310
|
+
|
|
311
|
+
# Restore from a checkpoint (rollback)
|
|
312
|
+
> checkpoint-restore abc12345
|
|
313
|
+
✓ Restored to: Backend API complete, frontend pending
|
|
314
|
+
✓ Restored 24 messages, 8 tool calls
|
|
315
|
+
✓ Working directory: ./my-project
|
|
316
|
+
✓ Pending tasks: 3
|
|
317
|
+
|
|
318
|
+
# Delete all checkpoints (WARNING: irreversible!)
|
|
319
|
+
> checkpoint-clear-all
|
|
320
|
+
⚠ Delete ALL checkpoints? (yes/no): yes
|
|
321
|
+
✓ Deleted 3 checkpoint(s)
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**Python API (for automation/testing):**
|
|
325
|
+
```python
|
|
326
|
+
from src.orchestration import AgentOrchestrator
|
|
327
|
+
|
|
328
|
+
# Start a multi-session project
|
|
329
|
+
orchestrator = AgentOrchestrator(
|
|
330
|
+
working_directory="./music-academy"
|
|
331
|
+
)
|
|
332
|
+
session = orchestrator.start_conversation(
|
|
333
|
+
task_description="Build online music learning academy"
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
# === Day 1: Build backend ===
|
|
337
|
+
session.send_message("Create database models for User, Course, Lesson")
|
|
338
|
+
session.send_message("Create FastAPI endpoints for course catalog")
|
|
339
|
+
|
|
340
|
+
# Create checkpoint before ending day
|
|
341
|
+
checkpoint_id = session.save_checkpoint(
|
|
342
|
+
description="Backend foundation complete",
|
|
343
|
+
phase="Phase 1 - Backend",
|
|
344
|
+
pending_tasks=[
|
|
345
|
+
"Create React frontend",
|
|
346
|
+
"Add authentication",
|
|
347
|
+
"Implement video player"
|
|
348
|
+
]
|
|
349
|
+
)
|
|
350
|
+
print(f"Checkpoint saved: {checkpoint_id}")
|
|
351
|
+
|
|
352
|
+
# End day 1
|
|
353
|
+
orchestrator.end_conversation(session.conversation_id)
|
|
354
|
+
|
|
355
|
+
# === Day 2: Resume work ===
|
|
356
|
+
# Start fresh session (simulates new day/terminal)
|
|
357
|
+
new_session = orchestrator.start_conversation(
|
|
358
|
+
task_description="Continue music academy"
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
# Restore checkpoint
|
|
362
|
+
new_session.restore_checkpoint(checkpoint_id)
|
|
363
|
+
# Agent now has full context from day 1!
|
|
364
|
+
|
|
365
|
+
# Continue building
|
|
366
|
+
new_session.send_message("Create the React student dashboard")
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**Checkpoint Features:**
|
|
370
|
+
- **Full Context Preservation**: Saves conversation history, files created, tool calls, and pending tasks
|
|
371
|
+
- **Cross-Session Resume**: Start new terminal/session and pick up exactly where you left off
|
|
372
|
+
- **Architecture Memory**: Agent remembers database schemas, API endpoints, and design decisions
|
|
373
|
+
- **Pending Task Tracking**: Checkpoint stores what's left to do (frontend, tests, deployment, etc.)
|
|
374
|
+
- **Project-Scoped**: Checkpoints stored in `.checkpoints/` directory within project workspace
|
|
375
|
+
- **Automatic Cleanup**: Configure `max_checkpoints` to auto-delete old checkpoints
|
|
376
|
+
|
|
377
|
+
**Common Use Cases:**
|
|
378
|
+
- **Multi-day development**: Build complex apps over several days with full context
|
|
379
|
+
- **Experiment safety**: Create checkpoint before trying risky changes, restore if needed
|
|
380
|
+
- **Team handoffs**: Share checkpoint ID so teammates can resume your work
|
|
381
|
+
- **Milestone tracking**: Save checkpoints after completing each project phase
|
|
382
|
+
- **Testing/QA**: Restore to specific states for bug reproduction
|
|
383
|
+
|
|
384
|
+
**Checkpoint vs Session Persistence:**
|
|
385
|
+
| Feature | Checkpoints | Session Persistence |
|
|
386
|
+
|---------|-------------|---------------------|
|
|
387
|
+
| **Purpose** | Work-in-progress snapshots | Complete conversation archives |
|
|
388
|
+
| **Scope** | Project-specific | Global across all projects |
|
|
389
|
+
| **Use Case** | Resume multi-day development | Pause/resume conversations |
|
|
390
|
+
| **Storage** | `.checkpoints/` in project | `.opencodeagent/sessions/` |
|
|
391
|
+
| **Restore Behavior** | Rolls back to checkpoint state | Loads full conversation |
|
|
392
|
+
| **Pending Tasks** | Yes, explicitly tracked | No, use tags instead |
|
|
393
|
+
|
|
394
|
+
**Checkpoint Storage:**
|
|
395
|
+
Checkpoints are stored in your project's `.checkpoints/` directory:
|
|
396
|
+
```
|
|
397
|
+
my-project/
|
|
398
|
+
.checkpoints/
|
|
399
|
+
checkpoint_abc12345.json # Includes working memory, tool history, pending tasks
|
|
400
|
+
checkpoint_def67890.json
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
Each checkpoint contains:
|
|
404
|
+
- **Conversation history**: All messages exchanged with agent
|
|
405
|
+
- **Tool execution history**: Files created/modified, commands run
|
|
406
|
+
- **Task context**: Current phase, pending tasks, file count
|
|
407
|
+
- **Metadata**: Timestamp, description, working directory
|
|
408
|
+
|
|
409
|
+
#### Python API
|
|
410
|
+
|
|
411
|
+
**Basic Usage:**
|
|
412
|
+
```python
|
|
413
|
+
from src.core import CodingAgent
|
|
414
|
+
|
|
415
|
+
# Initialize agent with OpenAI-compatible API (Alibaba Cloud example)
|
|
416
|
+
agent = CodingAgent(
|
|
417
|
+
backend="openai",
|
|
418
|
+
model_name="qwen3-coder-plus",
|
|
419
|
+
base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
|
|
420
|
+
api_key_env="DASHSCOPE_API_KEY",
|
|
421
|
+
context_window=32768,
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
# Or use local Ollama for complete data residency
|
|
425
|
+
agent = CodingAgent(
|
|
426
|
+
backend="ollama",
|
|
427
|
+
model_name="deepseek-coder:6.7b-instruct",
|
|
428
|
+
context_window=16384,
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
# Index your codebase
|
|
432
|
+
stats = agent.index_codebase(directory="./src")
|
|
433
|
+
print(f"Indexed {stats['total_files']} files")
|
|
434
|
+
|
|
435
|
+
# Execute a task - agent automatically decides workflow vs direct
|
|
436
|
+
response = agent.execute_task(
|
|
437
|
+
task_description="Explain how the RAG system works",
|
|
438
|
+
task_type="explain",
|
|
439
|
+
use_rag=True,
|
|
440
|
+
)
|
|
441
|
+
print(response.content)
|
|
442
|
+
|
|
443
|
+
# Interactive chat
|
|
444
|
+
response = agent.chat("What is the MemoryManager class?")
|
|
445
|
+
print(response)
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
**Workflow Features (Advanced):**
|
|
449
|
+
```python
|
|
450
|
+
# Implementation tasks automatically use workflow (analyze → plan → execute)
|
|
451
|
+
response = agent.execute_task(
|
|
452
|
+
task_description="Add a new tool for running shell commands",
|
|
453
|
+
task_type="implement",
|
|
454
|
+
)
|
|
455
|
+
# Output:
|
|
456
|
+
# 📊 TASK ANALYSIS
|
|
457
|
+
# Task Type: feature
|
|
458
|
+
# Complexity: MODERATE
|
|
459
|
+
# Risk Level: MEDIUM
|
|
460
|
+
# ... (detailed analysis)
|
|
461
|
+
#
|
|
462
|
+
# 📋 EXECUTION PLAN
|
|
463
|
+
# Step 1: Read existing tool implementations
|
|
464
|
+
# Step 2: Design new RunCommandTool class
|
|
465
|
+
# Step 3: Implement the tool
|
|
466
|
+
# ...
|
|
467
|
+
#
|
|
468
|
+
# ▶️ Step 1: starting...
|
|
469
|
+
# ✅ Step 1: completed
|
|
470
|
+
# ... (real-time progress)
|
|
471
|
+
|
|
472
|
+
# Explanation queries use fast direct execution
|
|
473
|
+
response = agent.execute_task(
|
|
474
|
+
task_description="How does the workflow system work?",
|
|
475
|
+
task_type="explain",
|
|
476
|
+
)
|
|
477
|
+
# → Fast response, no planning overhead
|
|
478
|
+
|
|
479
|
+
# Force specific execution mode if needed
|
|
480
|
+
response = agent.execute_task(
|
|
481
|
+
task_description="Some task",
|
|
482
|
+
force_workflow=True, # Always use workflow
|
|
483
|
+
# force_direct=True, # Always use direct
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
# Check execution mode in response metadata
|
|
487
|
+
print(response.metadata["execution_mode"]) # "workflow" or "direct"
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
**Session Persistence (Python API):**
|
|
491
|
+
```python
|
|
492
|
+
# Interactive work session
|
|
493
|
+
agent.chat("Implement JWT authentication")
|
|
494
|
+
agent.chat("Add login endpoint")
|
|
495
|
+
agent.chat("Add password hashing")
|
|
496
|
+
|
|
497
|
+
# Save session with metadata
|
|
498
|
+
session_id = agent.memory.save_session(
|
|
499
|
+
session_name="jwt-auth-feature",
|
|
500
|
+
task_description="Implementing JWT authentication for REST API",
|
|
501
|
+
tags=["feature", "auth", "backend"],
|
|
502
|
+
)
|
|
503
|
+
print(f"Session saved: {session_id[:8]}") # abc12345
|
|
504
|
+
|
|
505
|
+
# Later - create new agent and load session
|
|
506
|
+
new_agent = CodingAgent(backend="openai", model_name="qwen3-coder-plus")
|
|
507
|
+
new_agent.memory.load_session("abc12345") # Load by short ID
|
|
508
|
+
# Or: new_agent.memory.load_session("jwt-auth-feature") # Load by name
|
|
509
|
+
|
|
510
|
+
# Continue from where you left off with full context
|
|
511
|
+
new_agent.chat("Now add token refresh logic")
|
|
512
|
+
|
|
513
|
+
# List all saved sessions programmatically
|
|
514
|
+
from src.core.session_manager import SessionManager
|
|
515
|
+
session_mgr = SessionManager()
|
|
516
|
+
sessions = session_mgr.list_sessions()
|
|
517
|
+
for session in sessions:
|
|
518
|
+
print(f"{session.short_id}: {session.name} ({session.message_count} messages)")
|
|
519
|
+
|
|
520
|
+
# Filter sessions by tags
|
|
521
|
+
auth_sessions = session_mgr.list_sessions(tags=["auth"])
|
|
522
|
+
|
|
523
|
+
# Get detailed session info
|
|
524
|
+
metadata = session_mgr.get_session_metadata("abc12345")
|
|
525
|
+
print(f"Created: {metadata.created_at}")
|
|
526
|
+
print(f"Duration: {metadata.duration_minutes} minutes")
|
|
527
|
+
print(f"Tags: {', '.join(metadata.tags)}")
|
|
528
|
+
|
|
529
|
+
# Delete old sessions
|
|
530
|
+
session_mgr.delete_session("old-test-id")
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
## 📊 Performance & Testing
|
|
534
|
+
|
|
535
|
+
### Verified Capabilities ✅
|
|
536
|
+
- **RAG System**: 242 intelligent chunks from 28 files with AST-based parsing
|
|
537
|
+
- **Memory Management**: Multi-turn conversations with full context retention
|
|
538
|
+
- **Code Understanding**: Deep comprehension of complex architectures
|
|
539
|
+
- **Fast Inference**: 1-5 second responses with GPU acceleration
|
|
540
|
+
|
|
541
|
+
### Test Results (RunPod RTX 4090)
|
|
542
|
+
```
|
|
543
|
+
Response Times:
|
|
544
|
+
├─ Simple Query: 1.5s
|
|
545
|
+
├─ Code Generation: 1.5s
|
|
546
|
+
├─ Complex Explanation: 3-5s
|
|
547
|
+
└─ RAG Retrieval + Response: 4-6s
|
|
548
|
+
|
|
549
|
+
GPU Utilization:
|
|
550
|
+
├─ GPU Usage: 96% during inference
|
|
551
|
+
├─ Memory Bandwidth: 88%
|
|
552
|
+
└─ VRAM: 6.5GB / 24GB
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
**See [RUNPOD_TEST_RESULTS.md](RUNPOD_TEST_RESULTS.md)** for complete test report.
|
|
556
|
+
|
|
557
|
+
## 📁 Project Structure
|
|
558
|
+
|
|
559
|
+
```
|
|
560
|
+
ai-coding-agent/
|
|
561
|
+
├── src/
|
|
562
|
+
│ ├── core/ # Agent orchestration & context building
|
|
563
|
+
│ ├── memory/ # Hierarchical memory system
|
|
564
|
+
│ ├── rag/ # RAG system with AST parsing
|
|
565
|
+
│ ├── prompts/ # Prompt templates & optimization
|
|
566
|
+
│ ├── llm/ # LLM backend integrations
|
|
567
|
+
│ ├── tools/ # Tool execution engine
|
|
568
|
+
│ └── cli.py # Command-line interface
|
|
569
|
+
├── demo.py # Demo script
|
|
570
|
+
├── test_agent_capabilities.py # Comprehensive tests
|
|
571
|
+
├── requirements.txt # Python dependencies
|
|
572
|
+
└── Documentation/
|
|
573
|
+
├── ARCHITECTURE.md # System design
|
|
574
|
+
├── GETTING_STARTED.md # Detailed setup guide
|
|
575
|
+
├── RUNPOD_QUICKSTART.md # GPU deployment
|
|
576
|
+
└── RUNPOD_TEST_RESULTS.md # Test results
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
## 🔧 Configuration
|
|
580
|
+
|
|
581
|
+
### Environment Variables
|
|
582
|
+
```bash
|
|
583
|
+
# LLM Backend
|
|
584
|
+
OLLAMA_URL=http://localhost:11434
|
|
585
|
+
MODEL_NAME=deepseek-coder:6.7b-instruct
|
|
586
|
+
|
|
587
|
+
# Memory Configuration
|
|
588
|
+
MAX_WORKING_MEMORY_TOKENS=2048
|
|
589
|
+
MAX_EPISODIC_MEMORY_TOKENS=10240
|
|
590
|
+
|
|
591
|
+
# RAG Configuration
|
|
592
|
+
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
|
|
593
|
+
CHUNK_SIZE=512
|
|
594
|
+
CHUNK_OVERLAP=50
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### Supported Models
|
|
598
|
+
- **DeepSeek Coder** (6.7B, 33B) - Excellent for code understanding
|
|
599
|
+
- **CodeLlama** (7B, 13B, 34B) - General code generation
|
|
600
|
+
- **Qwen2.5-Coder** (7B, 14B, 32B) - Strong code intelligence
|
|
601
|
+
- **StarCoder2** (7B, 15B) - Code-specific training
|
|
602
|
+
- Any Ollama-compatible model
|
|
603
|
+
|
|
604
|
+
## 🎯 Use Cases
|
|
605
|
+
|
|
606
|
+
### Validated Use Cases
|
|
607
|
+
1. **Intelligent Code Implementation**: Plan-execute-verify workflow for feature development
|
|
608
|
+
2. **Code Explanation**: Understand complex architectures and patterns
|
|
609
|
+
3. **Bug Fixing**: Systematic debugging with step-by-step execution
|
|
610
|
+
4. **Code Refactoring**: Safe refactoring with dependency analysis
|
|
611
|
+
5. **Code Search**: Find relevant code using natural language queries
|
|
612
|
+
6. **Conversational Coding**: Multi-turn context-aware dialogue
|
|
613
|
+
7. **Knowledge Retrieval**: RAG-powered code knowledge base
|
|
614
|
+
|
|
615
|
+
### Example Workflows
|
|
616
|
+
|
|
617
|
+
**Scenario 1: Feature Implementation (Uses Workflow)**
|
|
618
|
+
```
|
|
619
|
+
User: "Add a new tool for listing directories"
|
|
620
|
+
|
|
621
|
+
Agent:
|
|
622
|
+
1. 📊 Analyzes: feature, moderate complexity, 3 files, 5 iterations
|
|
623
|
+
2. 📋 Creates Plan:
|
|
624
|
+
- Read existing tools
|
|
625
|
+
- Design new tool class
|
|
626
|
+
- Implement with error handling
|
|
627
|
+
- Write tests
|
|
628
|
+
- Integrate with agent
|
|
629
|
+
3. ⚙️ Executes: Step-by-step with real-time progress
|
|
630
|
+
4. ✅ Verifies: All steps completed successfully
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
**Scenario 2: Code Explanation (Uses Direct)**
|
|
634
|
+
```
|
|
635
|
+
User: "Explain how the memory system works"
|
|
636
|
+
|
|
637
|
+
Agent:
|
|
638
|
+
→ Fast direct execution (2-5 seconds)
|
|
639
|
+
→ Uses RAG to retrieve relevant code
|
|
640
|
+
→ Provides detailed explanation
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
**Scenario 3: Complex Refactoring (Uses Workflow + Approval)**
|
|
644
|
+
```
|
|
645
|
+
User: "Refactor the entire memory system to use Redis"
|
|
646
|
+
|
|
647
|
+
Agent:
|
|
648
|
+
1. 📊 Analyzes: refactor, very complex, HIGH RISK
|
|
649
|
+
2. 📋 Creates Plan: 12 steps with rollback strategy
|
|
650
|
+
3. ⏸️ Asks for Approval: Shows risk assessment
|
|
651
|
+
4. ⚙️ Executes: Only after user confirmation
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
### Ideal For
|
|
655
|
+
- Organizations with data residency requirements
|
|
656
|
+
- Teams needing self-hosted AI solutions
|
|
657
|
+
- Privacy-sensitive development environments
|
|
658
|
+
- Regulated industries (finance, healthcare, government)
|
|
659
|
+
- Developers who want transparent, explainable AI assistance
|
|
660
|
+
|
|
661
|
+
## 🛠️ Development
|
|
662
|
+
|
|
663
|
+
### Running Tests
|
|
664
|
+
```bash
|
|
665
|
+
# Install dev dependencies
|
|
666
|
+
pip install -r requirements-dev.txt
|
|
667
|
+
|
|
668
|
+
# Run comprehensive tests
|
|
669
|
+
python test_agent_capabilities.py
|
|
670
|
+
|
|
671
|
+
# Run demo
|
|
672
|
+
python demo.py
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
### Key Dependencies
|
|
676
|
+
- `transformers>=4.40.0` - HuggingFace models
|
|
677
|
+
- `sentence-transformers>=2.7.0` - Embeddings
|
|
678
|
+
- `chromadb>=0.4.24` - Vector database
|
|
679
|
+
- `tree-sitter==0.21.3` - AST parsing (specific version required)
|
|
680
|
+
- `tree-sitter-languages>=1.10.2` - Language parsers
|
|
681
|
+
- `pysqlite3-binary` - SQLite upgrade for ChromaDB
|
|
682
|
+
- `rich>=13.7.0` - Beautiful CLI output
|
|
683
|
+
|
|
684
|
+
## 🤝 Contributing
|
|
685
|
+
|
|
686
|
+
Contributions are welcome! Areas for improvement:
|
|
687
|
+
- Additional language parsers (JSX, Vue, etc.)
|
|
688
|
+
- More LLM backend integrations
|
|
689
|
+
- Enhanced tool system
|
|
690
|
+
- Web UI (FastAPI + React)
|
|
691
|
+
- Multi-agent coordination
|
|
692
|
+
|
|
693
|
+
## 📄 License
|
|
694
|
+
|
|
695
|
+
MIT License - See [LICENSE](LICENSE) for details.
|
|
696
|
+
|
|
697
|
+
## 🙏 Acknowledgments
|
|
698
|
+
|
|
699
|
+
Built with:
|
|
700
|
+
- [Ollama](https://ollama.ai/) - Local LLM runtime
|
|
701
|
+
- [ChromaDB](https://www.trychroma.com/) - Vector database
|
|
702
|
+
- [Tree-sitter](https://tree-sitter.github.io/) - AST parsing
|
|
703
|
+
- [Sentence Transformers](https://www.sbert.net/) - Embeddings
|
|
704
|
+
- [Rich](https://rich.readthedocs.io/) - Beautiful terminal output
|
|
705
|
+
|
|
706
|
+
## 📚 Documentation
|
|
707
|
+
|
|
708
|
+
### 🌟 Start Here (For Developers & AI Assistants)
|
|
709
|
+
|
|
710
|
+
**Essential Reading:**
|
|
711
|
+
1. **[CODEBASE_CONTEXT.md](CODEBASE_CONTEXT.md)** ⭐ - **Master project documentation**
|
|
712
|
+
- Complete codebase overview (85+ files)
|
|
713
|
+
- Architecture decisions and rationale
|
|
714
|
+
- File-by-file breakdown with purpose and key concepts
|
|
715
|
+
- Common development patterns
|
|
716
|
+
- Known issues and technical debt
|
|
717
|
+
- **Purpose:** Get full project context in < 2 minutes
|
|
718
|
+
|
|
719
|
+
2. **[README.md](README.md)** (this file) - User-facing documentation
|
|
720
|
+
- Quick start guide
|
|
721
|
+
- Usage examples
|
|
722
|
+
- Feature overview
|
|
723
|
+
|
|
724
|
+
3. **[CLAUDE.md](CLAUDE.md)** - Session handoff for AI assistants
|
|
725
|
+
- Current task status
|
|
726
|
+
- Recent changes (last session only)
|
|
727
|
+
- Immediate next steps
|
|
728
|
+
- **Purpose:** Quick session continuation
|
|
729
|
+
|
|
730
|
+
### Core System Documentation
|
|
731
|
+
|
|
732
|
+
**Setup & Deployment:**
|
|
733
|
+
- [GETTING_STARTED.md](GETTING_STARTED.md) - Detailed setup guide
|
|
734
|
+
- [RUNPOD_QUICKSTART.md](RUNPOD_QUICKSTART.md) - GPU deployment (5 minutes)
|
|
735
|
+
- [RUNPOD_DEPLOYMENT.md](RUNPOD_DEPLOYMENT.md) - Comprehensive GPU guide
|
|
736
|
+
- [RUNPOD_TEST_RESULTS.md](RUNPOD_TEST_RESULTS.md) - Performance benchmarks
|
|
737
|
+
|
|
738
|
+
**Architecture & Design:**
|
|
739
|
+
- [ARCHITECTURE.md](ARCHITECTURE.md) - Original system design
|
|
740
|
+
- [WORKFLOW_ARCHITECTURE.md](WORKFLOW_ARCHITECTURE.md) - Workflow system design (1,100+ lines)
|
|
741
|
+
|
|
742
|
+
### Workflow System Implementation (Week 1-2)
|
|
743
|
+
|
|
744
|
+
**Summaries:**
|
|
745
|
+
- [WORKFLOW_WEEK1_COMPLETE.md](WORKFLOW_WEEK1_COMPLETE.md) - Week 1 complete (400 lines)
|
|
746
|
+
- [WORKFLOW_WEEK2_DAY1_COMPLETE.md](WORKFLOW_WEEK2_DAY1_COMPLETE.md) - Bug fixes (29/29 tests passing!)
|
|
747
|
+
|
|
748
|
+
**Daily Implementation Details:**
|
|
749
|
+
- [WORKFLOW_DAY1_COMPLETE.md](WORKFLOW_DAY1_COMPLETE.md) - TaskAnalyzer implementation
|
|
750
|
+
- [WORKFLOW_DAY3-4_COMPLETE.md](WORKFLOW_DAY3-4_COMPLETE.md) - TaskPlanner implementation
|
|
751
|
+
- [WORKFLOW_DAY5_COMPLETE.md](WORKFLOW_DAY5_COMPLETE.md) - ExecutionEngine implementation
|
|
752
|
+
- [WORKFLOW_DAY6_COMPLETE.md](WORKFLOW_DAY6_COMPLETE.md) - Integration with CodingAgent
|
|
753
|
+
|
|
754
|
+
### Documentation Navigation Guide
|
|
755
|
+
|
|
756
|
+
**I'm a new developer, where do I start?**
|
|
757
|
+
→ Read [CODEBASE_CONTEXT.md](CODEBASE_CONTEXT.md) for complete project understanding, then [GETTING_STARTED.md](GETTING_STARTED.md) for setup
|
|
758
|
+
|
|
759
|
+
**I'm an AI assistant joining a session:**
|
|
760
|
+
→ Read [CODEBASE_CONTEXT.md](CODEBASE_CONTEXT.md) first (< 2 min), then [CLAUDE.md](CLAUDE.md) for current status
|
|
761
|
+
|
|
762
|
+
**I want to understand the workflow system:**
|
|
763
|
+
→ [WORKFLOW_ARCHITECTURE.md](WORKFLOW_ARCHITECTURE.md) for design, [WORKFLOW_WEEK1_COMPLETE.md](WORKFLOW_WEEK1_COMPLETE.md) for implementation summary
|
|
764
|
+
|
|
765
|
+
**I need to deploy on GPU:**
|
|
766
|
+
→ [RUNPOD_QUICKSTART.md](RUNPOD_QUICKSTART.md) for fast setup
|
|
767
|
+
|
|
768
|
+
**I want to understand a specific file:**
|
|
769
|
+
→ [CODEBASE_CONTEXT.md](CODEBASE_CONTEXT.md) has file-by-file breakdown with purpose and key concepts
|
|
770
|
+
|
|
771
|
+
## 🚀 What's Next?
|
|
772
|
+
|
|
773
|
+
**Workflow System - Week 1 Complete (✅ DONE):**
|
|
774
|
+
- [x] Intelligent workflow orchestration (2,000+ lines)
|
|
775
|
+
- [x] Task analysis and planning system
|
|
776
|
+
- [x] Step-by-step execution engine
|
|
777
|
+
- [x] Comprehensive testing (75+ tests)
|
|
778
|
+
|
|
779
|
+
**Workflow System - Week 2 Days 1-7 Complete (✅ DONE):**
|
|
780
|
+
- [x] Fixed callback signature mismatch (4 tests)
|
|
781
|
+
- [x] Fixed response generation data type issues
|
|
782
|
+
- [x] Fixed WorkingMemory len() access (2 tests)
|
|
783
|
+
- [x] All 29 integration tests passing ✅
|
|
784
|
+
- [x] Essential tools integrated (10 production tools)
|
|
785
|
+
- [x] Three-tier verification layer (always works, tool-enhanced, git-based)
|
|
786
|
+
- [x] E2E testing (8 comprehensive scenarios, 143/143 tests passing)
|
|
787
|
+
|
|
788
|
+
**Claude Code Integration - Phase 1 (In Progress):**
|
|
789
|
+
- [x] **File-Based Hierarchical Memory** (✅ COMPLETE)
|
|
790
|
+
- 4-level hierarchy (enterprise → user → project → imports)
|
|
791
|
+
- CLI commands (memory, memory-init, memory-add, memory-reload)
|
|
792
|
+
- Auto-loading on agent initialization
|
|
793
|
+
- 61 tests passing, 89% coverage on file_loader
|
|
794
|
+
- [ ] Permission Modes (Plan/Normal/Auto) - Week 1 remaining days
|
|
795
|
+
- [ ] Enhanced Prompts Integration - Week 2
|
|
796
|
+
|
|
797
|
+
**Near-Term Roadmap:**
|
|
798
|
+
- [ ] Automated Rollback System (Week 3: FileStateTracker + RollbackEngine)
|
|
799
|
+
- [ ] Multiple Tool Calls (Week 4: Parallel execution + batch operations)
|
|
800
|
+
|
|
801
|
+
**Future Enhancements:**
|
|
802
|
+
- [ ] Web UI (FastAPI + React)
|
|
803
|
+
- [ ] Multi-agent system
|
|
804
|
+
- [ ] Code execution sandbox
|
|
805
|
+
- [ ] Plugin system
|
|
806
|
+
- [ ] More language support (JSX, Vue, Kotlin, Swift)
|
|
807
|
+
|
|
808
|
+
---
|
|
809
|
+
|
|
810
|
+
**⭐ Star this repo if you find it useful!**
|
|
811
|
+
|
|
812
|
+
**💬 Questions?** Open an issue or discussion.
|
|
813
|
+
|
|
814
|
+
**📧 Contact:** [vijayjayanandan](https://github.com/vijayjayanandan)
|
|
815
|
+
|
|
816
|
+
**Made with ❤️ for the AI & open-source community**
|