pyeye-mcp 1.0.1__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.
- pyeye_mcp-1.0.1/.claude/README.md +60 -0
- pyeye_mcp-1.0.1/.claude/agents/INTEGRATION-EXAMPLE.md +238 -0
- pyeye_mcp-1.0.1/.claude/agents/README-SELF-IMPROVEMENT.md +326 -0
- pyeye_mcp-1.0.1/.claude/agents/TEMPLATE-WITH-LEARNING.md +296 -0
- pyeye_mcp-1.0.1/.claude/agents/cross-platform-issues.yaml +133 -0
- pyeye_mcp-1.0.1/.claude/agents/cross-platform-validator.md +195 -0
- pyeye_mcp-1.0.1/.claude/agents/pr-workflow.md +391 -0
- pyeye_mcp-1.0.1/.claude/agents/smart-commit-examples.md +193 -0
- pyeye_mcp-1.0.1/.claude/agents/smart-commit.md +316 -0
- pyeye_mcp-1.0.1/.claude/agents/worktree-manager.md +521 -0
- pyeye_mcp-1.0.1/.claude/feedback/.counters/worktree-manager.count +1 -0
- pyeye_mcp-1.0.1/.claude/feedback/.gitignore +9 -0
- pyeye_mcp-1.0.1/.claude/feedback/.last_analysis_worktree-manager +0 -0
- pyeye_mcp-1.0.1/.claude/feedback/.outcomes/worktree-manager.recent +2 -0
- pyeye_mcp-1.0.1/.claude/feedback/.patterns/worktree-manager.patterns +0 -0
- pyeye_mcp-1.0.1/.claude/feedback/.profiles/worktree-manager.profile +6 -0
- pyeye_mcp-1.0.1/.claude/feedback/ARCHITECTURE-DECISION.md +192 -0
- pyeye_mcp-1.0.1/.claude/feedback/EVENT-DRIVEN-SUMMARY.md +180 -0
- pyeye_mcp-1.0.1/.claude/feedback/IMPLEMENTATION-SUMMARY.md +174 -0
- pyeye_mcp-1.0.1/.claude/feedback/LEARNING-LIFECYCLE.md +249 -0
- pyeye_mcp-1.0.1/.claude/feedback/QUICK-START.md +109 -0
- pyeye_mcp-1.0.1/.claude/feedback/README.md +170 -0
- pyeye_mcp-1.0.1/.claude/feedback/WHEN-AGENTS-GET-SMARTER.md +196 -0
- pyeye_mcp-1.0.1/.claude/feedback/analyze_agent_performance.py +372 -0
- pyeye_mcp-1.0.1/.claude/feedback/apply_learnings.sh +247 -0
- pyeye_mcp-1.0.1/.claude/feedback/event_driven_learning.sh +536 -0
- pyeye_mcp-1.0.1/.claude/feedback/learnings/worktree-manager-learnings.md +174 -0
- pyeye_mcp-1.0.1/.claude/feedback/learnings/worktree-manager-report-20250830_152419.md +37 -0
- pyeye_mcp-1.0.1/.claude/feedback/learnings/worktree-manager-report-20250830_152513.md +37 -0
- pyeye_mcp-1.0.1/.claude/feedback/logs/.gitkeep +0 -0
- pyeye_mcp-1.0.1/.claude/feedback/metrics/.gitkeep +0 -0
- pyeye_mcp-1.0.1/.claude/instructions/00-documentation-system.md +146 -0
- pyeye_mcp-1.0.1/.claude/instructions/01-core-rules.md +140 -0
- pyeye_mcp-1.0.1/.claude/instructions/02-session-startup.md +136 -0
- pyeye_mcp-1.0.1/.claude/instructions/03-mcp-dogfooding.md +221 -0
- pyeye_mcp-1.0.1/.claude/instructions/04-agent-triggers.md +97 -0
- pyeye_mcp-1.0.1/.claude/instructions/05-workflow-issues.md +100 -0
- pyeye_mcp-1.0.1/.claude/instructions/06-workflow-commits.md +144 -0
- pyeye_mcp-1.0.1/.claude/instructions/07-validation.md +185 -0
- pyeye_mcp-1.0.1/.claude/instructions/08-project-specific.md +146 -0
- pyeye_mcp-1.0.1/.claude/instructions/09-task-management.md +125 -0
- pyeye_mcp-1.0.1/.claude/instructions/10-cross-platform.md +115 -0
- pyeye_mcp-1.0.1/.claude/instructions/11-pr-requirements.md +101 -0
- pyeye_mcp-1.0.1/.claude/settings.json +11 -0
- pyeye_mcp-1.0.1/.claude/startup-context.md +154 -0
- pyeye_mcp-1.0.1/.claude/worktree-helper.sh +108 -0
- pyeye_mcp-1.0.1/.github/dependabot.yml +67 -0
- pyeye_mcp-1.0.1/.github/pull_request_template.md +63 -0
- pyeye_mcp-1.0.1/.github/workflows/build-deploy-docs.yml +55 -0
- pyeye_mcp-1.0.1/.github/workflows/ci.yml +329 -0
- pyeye_mcp-1.0.1/.github/workflows/docs.yml +48 -0
- pyeye_mcp-1.0.1/.github/workflows/release.yml +287 -0
- pyeye_mcp-1.0.1/.gitignore +161 -0
- pyeye_mcp-1.0.1/.markdownlint.yaml +5 -0
- pyeye_mcp-1.0.1/.mcp.json.example +19 -0
- pyeye_mcp-1.0.1/.pre-commit-config.yaml +125 -0
- pyeye_mcp-1.0.1/.pydocstyle +5 -0
- pyeye_mcp-1.0.1/.pyeye.json.example +29 -0
- pyeye_mcp-1.0.1/.secrets.baseline +127 -0
- pyeye_mcp-1.0.1/CHANGELOG.md +264 -0
- pyeye_mcp-1.0.1/CLAUDE.md +80 -0
- pyeye_mcp-1.0.1/CONTRIBUTING.md +238 -0
- pyeye_mcp-1.0.1/DOCUMENTATION.md +859 -0
- pyeye_mcp-1.0.1/IMPLEMENTATION_SUMMARY.md +118 -0
- pyeye_mcp-1.0.1/LICENSE +21 -0
- pyeye_mcp-1.0.1/MIGRATION-PYEYE.md +216 -0
- pyeye_mcp-1.0.1/PKG-INFO +776 -0
- pyeye_mcp-1.0.1/README.md +725 -0
- pyeye_mcp-1.0.1/TEST_MIGRATION_GUIDE.md +129 -0
- pyeye_mcp-1.0.1/benchmarks/BASELINE_RESULTS.md +61 -0
- pyeye_mcp-1.0.1/benchmarks/benchmark_simple.py +84 -0
- pyeye_mcp-1.0.1/demo_analysis.md +83 -0
- pyeye_mcp-1.0.1/demo_find_symbol.py +124 -0
- pyeye_mcp-1.0.1/docs/CLAUDE_AGENTS.md +344 -0
- pyeye_mcp-1.0.1/docs/CLAUDE_WORKTREE_WORKFLOW.md +242 -0
- pyeye_mcp-1.0.1/docs/COVERAGE.md +201 -0
- pyeye_mcp-1.0.1/docs/DOGFOODING_INTEGRATION.md +204 -0
- pyeye_mcp-1.0.1/docs/DOGFOODING_SETUP.md +207 -0
- pyeye_mcp-1.0.1/docs/LABELS.md +132 -0
- pyeye_mcp-1.0.1/docs/METRICS_BASELINE.md +96 -0
- pyeye_mcp-1.0.1/docs/Makefile +37 -0
- pyeye_mcp-1.0.1/docs/RELEASE.md +154 -0
- pyeye_mcp-1.0.1/docs/TROUBLESHOOTING.md +796 -0
- pyeye_mcp-1.0.1/docs/UNIFIED_METRICS.md +315 -0
- pyeye_mcp-1.0.1/docs/api/README.md +166 -0
- pyeye_mcp-1.0.1/docs/api/core-navigation.md +845 -0
- pyeye_mcp-1.0.1/docs/api/django-tools.md +1047 -0
- pyeye_mcp-1.0.1/docs/api/flask-tools.md +1196 -0
- pyeye_mcp-1.0.1/docs/api/module-analysis.md +647 -0
- pyeye_mcp-1.0.1/docs/api/pydantic-tools.md +1041 -0
- pyeye_mcp-1.0.1/docs/api/quick-reference.md +297 -0
- pyeye_mcp-1.0.1/docs/development/test_generation_guidelines.md +195 -0
- pyeye_mcp-1.0.1/docs/migration-guide.md +330 -0
- pyeye_mcp-1.0.1/docs/namespace-packages.md +446 -0
- pyeye_mcp-1.0.1/docs/source/_static/.gitkeep +0 -0
- pyeye_mcp-1.0.1/docs/source/api/index.rst +66 -0
- pyeye_mcp-1.0.1/docs/source/architecture/caching-strategy.rst +341 -0
- pyeye_mcp-1.0.1/docs/source/architecture/index.rst +13 -0
- pyeye_mcp-1.0.1/docs/source/architecture/overview.rst +174 -0
- pyeye_mcp-1.0.1/docs/source/architecture/plugin-system.rst +307 -0
- pyeye_mcp-1.0.1/docs/source/conf.py +115 -0
- pyeye_mcp-1.0.1/docs/source/configuration.rst +424 -0
- pyeye_mcp-1.0.1/docs/source/contributing.rst +265 -0
- pyeye_mcp-1.0.1/docs/source/examples/index.rst +367 -0
- pyeye_mcp-1.0.1/docs/source/index.rst +97 -0
- pyeye_mcp-1.0.1/docs/source/quickstart.rst +208 -0
- pyeye_mcp-1.0.1/docs/test_coverage_agent_usage.md +254 -0
- pyeye_mcp-1.0.1/docs/testing/CONVENTIONS.md +522 -0
- pyeye_mcp-1.0.1/docs/testing/FIXTURES.md +617 -0
- pyeye_mcp-1.0.1/docs/testing/PERFORMANCE.md +619 -0
- pyeye_mcp-1.0.1/docs/testing/STRATEGY.md +366 -0
- pyeye_mcp-1.0.1/examples/configurations/enterprise.json +97 -0
- pyeye_mcp-1.0.1/examples/configurations/microservices.json +47 -0
- pyeye_mcp-1.0.1/examples/configurations/monorepo.json +27 -0
- pyeye_mcp-1.0.1/examples/configurations/plugin-system.json +46 -0
- pyeye_mcp-1.0.1/examples/test_project/example.py +155 -0
- pyeye_mcp-1.0.1/pyproject.toml +181 -0
- pyeye_mcp-1.0.1/scripts/check_cross_platform_paths.py +187 -0
- pyeye_mcp-1.0.1/scripts/claude_hooks/README.md +193 -0
- pyeye_mcp-1.0.1/scripts/claude_hooks/detect_grep_usage.py +97 -0
- pyeye_mcp-1.0.1/scripts/claude_hooks/hooks.json +64 -0
- pyeye_mcp-1.0.1/scripts/claude_hooks/mcp_analytics.py +214 -0
- pyeye_mcp-1.0.1/scripts/claude_hooks/session_tracker.py +71 -0
- pyeye_mcp-1.0.1/scripts/claude_hooks/setup_mcp_monitoring.sh +156 -0
- pyeye_mcp-1.0.1/scripts/claude_hooks/track_mcp_call.py +66 -0
- pyeye_mcp-1.0.1/scripts/claude_hooks/track_mcp_success.py +72 -0
- pyeye_mcp-1.0.1/scripts/dogfooding_metrics.py +402 -0
- pyeye_mcp-1.0.1/scripts/grep_tracker.sh +56 -0
- pyeye_mcp-1.0.1/scripts/install_hooks.sh +98 -0
- pyeye_mcp-1.0.1/scripts/mcp_wrapper.sh +11 -0
- pyeye_mcp-1.0.1/scripts/setup_aliases.sh +78 -0
- pyeye_mcp-1.0.1/scripts/setup_dogfooding.sh +107 -0
- pyeye_mcp-1.0.1/scripts/setup_grep_tracking.sh +66 -0
- pyeye_mcp-1.0.1/scripts/test_coverage_agent.py +237 -0
- pyeye_mcp-1.0.1/scripts/test_cross_platform_agent.py +146 -0
- pyeye_mcp-1.0.1/scripts/unified_metrics.py +285 -0
- pyeye_mcp-1.0.1/scripts/validate_changelog.py +191 -0
- pyeye_mcp-1.0.1/scripts/worktree_safety.py +328 -0
- pyeye_mcp-1.0.1/setup.cfg +4 -0
- pyeye_mcp-1.0.1/setup.sh +45 -0
- pyeye_mcp-1.0.1/src/pyeye/__init__.py +22 -0
- pyeye_mcp-1.0.1/src/pyeye/_version.py +3 -0
- pyeye_mcp-1.0.1/src/pyeye/_version.pyi +2 -0
- pyeye_mcp-1.0.1/src/pyeye/agents/__init__.py +8 -0
- pyeye_mcp-1.0.1/src/pyeye/agents/test_coverage.py +291 -0
- pyeye_mcp-1.0.1/src/pyeye/agents/test_coverage_enhanced.py +599 -0
- pyeye_mcp-1.0.1/src/pyeye/analyzers/__init__.py +5 -0
- pyeye_mcp-1.0.1/src/pyeye/analyzers/jedi_analyzer.py +2723 -0
- pyeye_mcp-1.0.1/src/pyeye/async_utils.py +250 -0
- pyeye_mcp-1.0.1/src/pyeye/cache.py +439 -0
- pyeye_mcp-1.0.1/src/pyeye/config.py +538 -0
- pyeye_mcp-1.0.1/src/pyeye/connection_pool.py +238 -0
- pyeye_mcp-1.0.1/src/pyeye/constants.py +25 -0
- pyeye_mcp-1.0.1/src/pyeye/dependency_tracker.py +194 -0
- pyeye_mcp-1.0.1/src/pyeye/dogfooding_integration.py +188 -0
- pyeye_mcp-1.0.1/src/pyeye/exceptions.py +315 -0
- pyeye_mcp-1.0.1/src/pyeye/import_analyzer.py +332 -0
- pyeye_mcp-1.0.1/src/pyeye/mcp/__init__.py +5 -0
- pyeye_mcp-1.0.1/src/pyeye/mcp/__main__.py +10 -0
- pyeye_mcp-1.0.1/src/pyeye/mcp/server.py +845 -0
- pyeye_mcp-1.0.1/src/pyeye/metrics.py +355 -0
- pyeye_mcp-1.0.1/src/pyeye/metrics_hook.py +129 -0
- pyeye_mcp-1.0.1/src/pyeye/namespace_resolver.py +261 -0
- pyeye_mcp-1.0.1/src/pyeye/path_utils.py +139 -0
- pyeye_mcp-1.0.1/src/pyeye/plugins/__init__.py +5 -0
- pyeye_mcp-1.0.1/src/pyeye/plugins/base.py +237 -0
- pyeye_mcp-1.0.1/src/pyeye/plugins/django.py +251 -0
- pyeye_mcp-1.0.1/src/pyeye/plugins/flask.py +612 -0
- pyeye_mcp-1.0.1/src/pyeye/plugins/pydantic.py +499 -0
- pyeye_mcp-1.0.1/src/pyeye/project_manager.py +377 -0
- pyeye_mcp-1.0.1/src/pyeye/scope_utils.py +543 -0
- pyeye_mcp-1.0.1/src/pyeye/settings.py +195 -0
- pyeye_mcp-1.0.1/src/pyeye/symbol_parser.py +151 -0
- pyeye_mcp-1.0.1/src/pyeye/unified_metrics.py +495 -0
- pyeye_mcp-1.0.1/src/pyeye/validation.py +401 -0
- pyeye_mcp-1.0.1/src/pyeye/workflows/code_review_pr.md +670 -0
- pyeye_mcp-1.0.1/src/pyeye/workflows/code_review_security.md +641 -0
- pyeye_mcp-1.0.1/src/pyeye/workflows/code_review_standards.md +722 -0
- pyeye_mcp-1.0.1/src/pyeye/workflows/code_understanding.md +357 -0
- pyeye_mcp-1.0.1/src/pyeye/workflows/dependency_analysis.md +460 -0
- pyeye_mcp-1.0.1/src/pyeye/workflows/find_references.md +161 -0
- pyeye_mcp-1.0.1/src/pyeye/workflows/refactoring.md +254 -0
- pyeye_mcp-1.0.1/src/pyeye_mcp.egg-info/PKG-INFO +776 -0
- pyeye_mcp-1.0.1/src/pyeye_mcp.egg-info/SOURCES.txt +256 -0
- pyeye_mcp-1.0.1/src/pyeye_mcp.egg-info/dependency_links.txt +1 -0
- pyeye_mcp-1.0.1/src/pyeye_mcp.egg-info/requires.txt +29 -0
- pyeye_mcp-1.0.1/src/pyeye_mcp.egg-info/top_level.txt +1 -0
- pyeye_mcp-1.0.1/tests/__init__.py +1 -0
- pyeye_mcp-1.0.1/tests/conftest.py +319 -0
- pyeye_mcp-1.0.1/tests/e2e/__init__.py +0 -0
- pyeye_mcp-1.0.1/tests/e2e/scenarios/test_end_to_end.py +396 -0
- pyeye_mcp-1.0.1/tests/fixtures/__init__.py +0 -0
- pyeye_mcp-1.0.1/tests/fixtures/factories.py +449 -0
- pyeye_mcp-1.0.1/tests/fixtures/reexport_test/__init__.py +1 -0
- pyeye_mcp-1.0.1/tests/fixtures/reexport_test/core/__init__.py +9 -0
- pyeye_mcp-1.0.1/tests/fixtures/reexport_test/core/auth/__init__.py +5 -0
- pyeye_mcp-1.0.1/tests/fixtures/reexport_test/core/auth/authenticator.py +18 -0
- pyeye_mcp-1.0.1/tests/fixtures/reexport_test/models/__init__.py +10 -0
- pyeye_mcp-1.0.1/tests/fixtures/reexport_test/models/user.py +26 -0
- pyeye_mcp-1.0.1/tests/fixtures/standalone_project/.pyeye.json +14 -0
- pyeye_mcp-1.0.1/tests/fixtures/standalone_project/mypackage/__init__.py +5 -0
- pyeye_mcp-1.0.1/tests/fixtures/standalone_project/mypackage/models.py +18 -0
- pyeye_mcp-1.0.1/tests/fixtures/standalone_project/notebooks/analysis1.py +19 -0
- pyeye_mcp-1.0.1/tests/fixtures/standalone_project/notebooks/analysis2.py +17 -0
- pyeye_mcp-1.0.1/tests/fixtures/standalone_project/scripts/migrate.py +24 -0
- pyeye_mcp-1.0.1/tests/integration/__init__.py +0 -0
- pyeye_mcp-1.0.1/tests/integration/cache_system/test_smart_invalidation_integration.py +360 -0
- pyeye_mcp-1.0.1/tests/integration/jedi_integration/test_jedi_analyzer.py +1051 -0
- pyeye_mcp-1.0.1/tests/integration/jedi_integration/test_jedi_integration.py +355 -0
- pyeye_mcp-1.0.1/tests/integration/jedi_integration/test_module_analysis.py +469 -0
- pyeye_mcp-1.0.1/tests/integration/jedi_integration/test_relative_imports.py +377 -0
- pyeye_mcp-1.0.1/tests/integration/jedi_integration/test_src_layout.py +610 -0
- pyeye_mcp-1.0.1/tests/integration/mcp_protocol/test_mcp_integration.py +184 -0
- pyeye_mcp-1.0.1/tests/integration/mcp_protocol/test_server.py +847 -0
- pyeye_mcp-1.0.1/tests/integration/test_compound_symbols.py +358 -0
- pyeye_mcp-1.0.1/tests/integration/test_connection_pool.py +366 -0
- pyeye_mcp-1.0.1/tests/integration/test_dependency_tracker.py +300 -0
- pyeye_mcp-1.0.1/tests/integration/test_namespace_methods.py +632 -0
- pyeye_mcp-1.0.1/tests/integration/test_namespace_resolver.py +282 -0
- pyeye_mcp-1.0.1/tests/integration/test_namespace_support.py +469 -0
- pyeye_mcp-1.0.1/tests/integration/test_polymorphic_references.py +475 -0
- pyeye_mcp-1.0.1/tests/integration/test_project_manager.py +247 -0
- pyeye_mcp-1.0.1/tests/integration/test_project_manager_pooling.py +295 -0
- pyeye_mcp-1.0.1/tests/integration/test_scope_configuration.py +403 -0
- pyeye_mcp-1.0.1/tests/integration/test_standalone_scripts.py +271 -0
- pyeye_mcp-1.0.1/tests/performance/__init__.py +0 -0
- pyeye_mcp-1.0.1/tests/performance/benchmarks/test_find_imports_performance.py +185 -0
- pyeye_mcp-1.0.1/tests/performance/benchmarks/test_performance_benchmarks.py +439 -0
- pyeye_mcp-1.0.1/tests/performance/benchmarks/test_performance_regression.py +369 -0
- pyeye_mcp-1.0.1/tests/performance/benchmarks/test_scope_performance.py +430 -0
- pyeye_mcp-1.0.1/tests/test_automation.py +207 -0
- pyeye_mcp-1.0.1/tests/test_coverage_agent.py +422 -0
- pyeye_mcp-1.0.1/tests/test_dogfooding_integration.py +205 -0
- pyeye_mcp-1.0.1/tests/test_dogfooding_metrics.py +149 -0
- pyeye_mcp-1.0.1/tests/test_dogfooding_workflow.py +84 -0
- pyeye_mcp-1.0.1/tests/test_get_type_info_inheritance.py +575 -0
- pyeye_mcp-1.0.1/tests/test_helpers.py +15 -0
- pyeye_mcp-1.0.1/tests/test_posixpath_serialization.py +155 -0
- pyeye_mcp-1.0.1/tests/test_resources.py +258 -0
- pyeye_mcp-1.0.1/tests/unit/__init__.py +0 -0
- pyeye_mcp-1.0.1/tests/unit/core/test_cache.py +300 -0
- pyeye_mcp-1.0.1/tests/unit/core/test_config.py +524 -0
- pyeye_mcp-1.0.1/tests/unit/core/test_exceptions.py +246 -0
- pyeye_mcp-1.0.1/tests/unit/core/test_granular_cache.py +436 -0
- pyeye_mcp-1.0.1/tests/unit/core/test_settings.py +212 -0
- pyeye_mcp-1.0.1/tests/unit/core/test_validation.py +323 -0
- pyeye_mcp-1.0.1/tests/unit/core/test_version_validation.py +35 -0
- pyeye_mcp-1.0.1/tests/unit/plugins/test_django_plugin.py +387 -0
- pyeye_mcp-1.0.1/tests/unit/plugins/test_flask_plugin.py +750 -0
- pyeye_mcp-1.0.1/tests/unit/plugins/test_pydantic_plugin.py +758 -0
- pyeye_mcp-1.0.1/tests/unit/test_symbol_parser.py +249 -0
- pyeye_mcp-1.0.1/tests/unit/utils/test_async_utils.py +656 -0
- pyeye_mcp-1.0.1/tests/unit/utils/test_metrics.py +338 -0
- pyeye_mcp-1.0.1/tests/unit/utils/test_path_utils.py +341 -0
- pyeye_mcp-1.0.1/tests/unit/utils/test_unified_metrics_core.py +167 -0
- pyeye_mcp-1.0.1/tests/unit/utils/test_utils.py +137 -0
- pyeye_mcp-1.0.1/tests/utils/__init__.py +1 -0
- pyeye_mcp-1.0.1/tests/utils/performance.py +166 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# ⚠️ This Directory is for Claude Code, Not Humans
|
|
2
|
+
|
|
3
|
+
## Humans: You're in the Wrong Place
|
|
4
|
+
|
|
5
|
+
This directory contains behavioral instructions for Claude Code (AI assistant). These files control how Claude behaves when working on this project.
|
|
6
|
+
|
|
7
|
+
### Looking for Documentation?
|
|
8
|
+
|
|
9
|
+
- **Project Overview**: See [`/README.md`](../README.md)
|
|
10
|
+
- **Contributing Guide**: See [`/CONTRIBUTING.md`](../CONTRIBUTING.md)
|
|
11
|
+
- **Documentation**: See [`/docs`](../docs/)
|
|
12
|
+
- **API Reference**: See [`/docs/api`](../docs/api/)
|
|
13
|
+
|
|
14
|
+
### For Maintainers Only
|
|
15
|
+
|
|
16
|
+
If you need to modify Claude's behavior:
|
|
17
|
+
|
|
18
|
+
#### Directory Structure
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
.claude/
|
|
22
|
+
├── instructions/ # Modular behavior rules
|
|
23
|
+
│ ├── 00-*.md # Core understanding
|
|
24
|
+
│ ├── 01-*.md # Fundamental rules
|
|
25
|
+
│ ├── 02-*.md # Startup/context
|
|
26
|
+
│ └── ... # Other behaviors
|
|
27
|
+
├── agents/ # Agent definitions
|
|
28
|
+
├── feedback/ # Learning/logs
|
|
29
|
+
└── settings.json # Configuration
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### Key Files
|
|
33
|
+
|
|
34
|
+
- `instructions/00-documentation-system.md` - Teaches Claude about documentation
|
|
35
|
+
- `instructions/01-core-rules.md` - Critical behavior rules
|
|
36
|
+
- `instructions/04-agent-triggers.md` - When to use specific agents
|
|
37
|
+
|
|
38
|
+
#### Making Changes
|
|
39
|
+
|
|
40
|
+
1. Changes here immediately affect Claude's behavior
|
|
41
|
+
2. Use IMPERATIVE language (MUST, NEVER, ALWAYS)
|
|
42
|
+
3. Keep instructions concise and enforceable
|
|
43
|
+
4. Don't put human explanations here - use `/docs` instead
|
|
44
|
+
|
|
45
|
+
#### Understanding the System
|
|
46
|
+
|
|
47
|
+
The instruction files use a numbered prefix system:
|
|
48
|
+
|
|
49
|
+
- `00-*` Foundational understanding
|
|
50
|
+
- `01-*` Core rules and enforcement
|
|
51
|
+
- `02-*` Startup and context detection
|
|
52
|
+
- `03-*` Required practices
|
|
53
|
+
- `04-*` Behavioral triggers
|
|
54
|
+
- `05-07-*` Workflows
|
|
55
|
+
- `08-*` Project-specific
|
|
56
|
+
- `09-10-*` Tools and utilities
|
|
57
|
+
|
|
58
|
+
### Warning
|
|
59
|
+
|
|
60
|
+
Modifying these files changes how Claude behaves across ALL sessions on this project. Be careful and test changes thoroughly.
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: example-with-event-learning
|
|
3
|
+
description: Example agent showing how to integrate with event-driven learning
|
|
4
|
+
tools: Bash, Read, Edit
|
|
5
|
+
color: cyan
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Example Agent with Event-Driven Learning Integration
|
|
9
|
+
|
|
10
|
+
This example shows how agents can integrate with the event-driven learning system.
|
|
11
|
+
|
|
12
|
+
## Startup: Source the Learning System
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# At agent startup, source the learning functions
|
|
16
|
+
source "${CLAUDE_FEEDBACK_DIR:-/home/mark/GitHub/pyeye-mcp-work/claude-development/.claude/feedback}/event_driven_learning.sh"
|
|
17
|
+
|
|
18
|
+
AGENT_NAME="example-with-event-learning"
|
|
19
|
+
|
|
20
|
+
# Signal execution start (increments counter, checks thresholds)
|
|
21
|
+
handle_agent_event "execution_start" "$AGENT_NAME"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## During Execution: Track Events
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Example task function with event tracking
|
|
28
|
+
perform_task() {
|
|
29
|
+
local task_path="$1"
|
|
30
|
+
|
|
31
|
+
# Try the operation
|
|
32
|
+
if cd "$task_path" 2>/dev/null; then
|
|
33
|
+
echo "✓ Successfully changed to $task_path"
|
|
34
|
+
else
|
|
35
|
+
# Log the issue pattern
|
|
36
|
+
handle_agent_event "issue_detected" "$AGENT_NAME" "path_error" "Failed to cd to $task_path"
|
|
37
|
+
|
|
38
|
+
# Try recovery with absolute path
|
|
39
|
+
task_path="$(realpath "$task_path" 2>/dev/null || pwd)"
|
|
40
|
+
if cd "$task_path"; then
|
|
41
|
+
echo "✓ Recovered using absolute path"
|
|
42
|
+
else
|
|
43
|
+
# Track failure
|
|
44
|
+
handle_agent_event "execution_complete" "$AGENT_NAME" "failure"
|
|
45
|
+
return 1
|
|
46
|
+
fi
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# Continue with task...
|
|
50
|
+
echo "Performing task in $(pwd)"
|
|
51
|
+
|
|
52
|
+
# Simulate some work
|
|
53
|
+
if [ -w "." ]; then
|
|
54
|
+
echo "✓ Have write permissions"
|
|
55
|
+
else
|
|
56
|
+
# Another pattern to track
|
|
57
|
+
handle_agent_event "issue_detected" "$AGENT_NAME" "permission_denied" "No write permission in $(pwd)"
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
return 0
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Completion: Report Outcome
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Main execution flow
|
|
68
|
+
main() {
|
|
69
|
+
echo "Starting $AGENT_NAME"
|
|
70
|
+
|
|
71
|
+
# Track start
|
|
72
|
+
handle_agent_event "execution_start" "$AGENT_NAME"
|
|
73
|
+
|
|
74
|
+
# Perform the actual work
|
|
75
|
+
if perform_task "$@"; then
|
|
76
|
+
# Success
|
|
77
|
+
handle_agent_event "execution_complete" "$AGENT_NAME" "success"
|
|
78
|
+
echo "✅ Task completed successfully"
|
|
79
|
+
else
|
|
80
|
+
# Failure
|
|
81
|
+
handle_agent_event "execution_complete" "$AGENT_NAME" "failure"
|
|
82
|
+
echo "❌ Task failed"
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
# The event system will automatically:
|
|
86
|
+
# 1. Check if execution threshold reached (triggers learning)
|
|
87
|
+
# 2. Monitor failure rate (triggers immediate fixes)
|
|
88
|
+
# 3. Detect repeated patterns (applies known fixes)
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Real-Time Pattern Response
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Advanced: Agent can check for patterns in real-time
|
|
96
|
+
check_and_adapt() {
|
|
97
|
+
local operation=$1
|
|
98
|
+
|
|
99
|
+
# Before attempting operation, check if it's been problematic
|
|
100
|
+
if grep -q "$operation.*failed" "$CLAUDE_FEEDBACK_DIR/.patterns/${AGENT_NAME}.patterns" 2>/dev/null; then
|
|
101
|
+
echo "⚠️ This operation has failed before - using enhanced approach"
|
|
102
|
+
|
|
103
|
+
# Use learned approach
|
|
104
|
+
case "$operation" in
|
|
105
|
+
"cd")
|
|
106
|
+
echo "Using absolute paths (learned from failures)"
|
|
107
|
+
USE_ABSOLUTE_PATHS=true
|
|
108
|
+
;;
|
|
109
|
+
"git")
|
|
110
|
+
echo "Adding retry logic (learned from failures)"
|
|
111
|
+
MAX_RETRIES=5
|
|
112
|
+
;;
|
|
113
|
+
esac
|
|
114
|
+
fi
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Session End Hook
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# At session end (or context switch)
|
|
122
|
+
cleanup() {
|
|
123
|
+
echo "Session ending for $AGENT_NAME"
|
|
124
|
+
|
|
125
|
+
# Trigger session-end analysis
|
|
126
|
+
handle_agent_event "session_end"
|
|
127
|
+
|
|
128
|
+
# This will:
|
|
129
|
+
# - Analyze all agents active this session
|
|
130
|
+
# - Apply learnings if thresholds met
|
|
131
|
+
# - Update agent files if patterns detected
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
# Register cleanup
|
|
135
|
+
trap cleanup EXIT
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## How It Works - The Flow
|
|
139
|
+
|
|
140
|
+
1. **Execution starts** → Counter increments → Checks if threshold reached
|
|
141
|
+
2. **Issues occur** → Patterns logged → Checks if pattern repeated
|
|
142
|
+
3. **Execution ends** → Outcome tracked → Checks failure rate
|
|
143
|
+
4. **Thresholds triggered** → Analysis runs → Fixes applied automatically
|
|
144
|
+
|
|
145
|
+
## Benefits of Integration
|
|
146
|
+
|
|
147
|
+
1. **No Manual Tracking** - Events logged automatically
|
|
148
|
+
2. **Real-Time Response** - Fixes applied during execution
|
|
149
|
+
3. **Adaptive Thresholds** - Adjusts based on agent performance
|
|
150
|
+
4. **Known Fix Database** - Common issues fixed immediately
|
|
151
|
+
5. **Session Persistence** - Learning continues across sessions
|
|
152
|
+
|
|
153
|
+
## Example Trigger Scenarios
|
|
154
|
+
|
|
155
|
+
### Scenario 1: Execution Threshold
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
Agent runs 10 times → Threshold reached → Analysis triggered →
|
|
159
|
+
Patterns found → Agent updated → Next run uses improvements
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Scenario 2: High Failure Rate
|
|
163
|
+
|
|
164
|
+
```text
|
|
165
|
+
3 failures in last 10 runs → Failure threshold hit →
|
|
166
|
+
Immediate analysis → Critical fixes applied → Agent recovers
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Scenario 3: Pattern Detection
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
Same error 3 times → Pattern detected → Known fix exists →
|
|
173
|
+
Fix applied immediately → Error stops occurring
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Testing the Integration
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Test execution counter
|
|
180
|
+
for i in {1..10}; do
|
|
181
|
+
./example-with-event-learning.sh test_task
|
|
182
|
+
done
|
|
183
|
+
# Should trigger learning after 10 executions
|
|
184
|
+
|
|
185
|
+
# Test failure tracking
|
|
186
|
+
for i in {1..3}; do
|
|
187
|
+
./example-with-event-learning.sh /nonexistent/path
|
|
188
|
+
done
|
|
189
|
+
# Should trigger high failure rate response
|
|
190
|
+
|
|
191
|
+
# Test pattern detection
|
|
192
|
+
for i in {1..3}; do
|
|
193
|
+
handle_agent_event "issue_detected" "example-with-event-learning" "timeout"
|
|
194
|
+
done
|
|
195
|
+
# Should detect pattern and suggest/apply timeout fix
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Customizing Thresholds
|
|
199
|
+
|
|
200
|
+
Create agent-specific profile:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
cat > $CLAUDE_FEEDBACK_DIR/.profiles/example-with-event-learning.profile << EOF
|
|
204
|
+
EXECUTION_THRESHOLD=5 # Check every 5 runs (not 10)
|
|
205
|
+
FAILURE_THRESHOLD=2 # React after 2 failures (not 3)
|
|
206
|
+
PATTERN_THRESHOLD=2 # Detect pattern after 2 occurrences
|
|
207
|
+
AUTO_FIX_ENABLED=true # Apply fixes automatically
|
|
208
|
+
EOF
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Monitoring & Metrics
|
|
212
|
+
|
|
213
|
+
Check agent's learning status:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# View current counters
|
|
217
|
+
cat $CLAUDE_FEEDBACK_DIR/.counters/example-with-event-learning.count
|
|
218
|
+
|
|
219
|
+
# View recent outcomes
|
|
220
|
+
cat $CLAUDE_FEEDBACK_DIR/.outcomes/example-with-event-learning.recent
|
|
221
|
+
|
|
222
|
+
# View detected patterns
|
|
223
|
+
cat $CLAUDE_FEEDBACK_DIR/.patterns/example-with-event-learning.patterns
|
|
224
|
+
|
|
225
|
+
# Run manual analysis
|
|
226
|
+
$CLAUDE_FEEDBACK_DIR/event_driven_learning.sh check_agent example-with-event-learning
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## The Result
|
|
230
|
+
|
|
231
|
+
Agents that integrate with event-driven learning:
|
|
232
|
+
|
|
233
|
+
- **Get smarter automatically** based on usage
|
|
234
|
+
- **Fix themselves** when patterns detected
|
|
235
|
+
- **Adapt thresholds** based on performance
|
|
236
|
+
- **Share knowledge** through the learning system
|
|
237
|
+
|
|
238
|
+
No cron jobs. No waiting. Just intelligent, event-driven improvement!
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# Agent Self-Improvement & Learning System
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document describes the self-improvement feedback mechanism for Claude Code agents, enabling them to learn from issues, adapt their behavior, and improve over time.
|
|
6
|
+
|
|
7
|
+
## 🎯 Core Principles
|
|
8
|
+
|
|
9
|
+
1. **Capture Issues**: Document problems as they occur
|
|
10
|
+
2. **Analyze Patterns**: Identify recurring issues
|
|
11
|
+
3. **Update Instructions**: Evolve agent behavior based on learnings
|
|
12
|
+
4. **Track Improvements**: Measure success of changes
|
|
13
|
+
5. **Share Knowledge**: Cross-agent learning
|
|
14
|
+
|
|
15
|
+
## 📁 Feedback Structure
|
|
16
|
+
|
|
17
|
+
### Directory Layout
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
.claude/
|
|
21
|
+
├── agents/
|
|
22
|
+
│ ├── worktree-manager.md
|
|
23
|
+
│ ├── smart-commit.md
|
|
24
|
+
│ ├── pr-workflow.md
|
|
25
|
+
│ └── ...
|
|
26
|
+
├── feedback/
|
|
27
|
+
│ ├── logs/
|
|
28
|
+
│ │ ├── 2025-01-30-worktree-manager.json
|
|
29
|
+
│ │ ├── 2025-01-30-smart-commit.json
|
|
30
|
+
│ │ └── ...
|
|
31
|
+
│ ├── learnings/
|
|
32
|
+
│ │ ├── worktree-manager-learnings.md
|
|
33
|
+
│ │ ├── smart-commit-learnings.md
|
|
34
|
+
│ │ └── ...
|
|
35
|
+
│ └── metrics/
|
|
36
|
+
│ └── agent-performance.json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 📝 Feedback Log Format
|
|
40
|
+
|
|
41
|
+
Each agent execution should log feedback in JSON format:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"timestamp": "2025-01-30T14:43:40.896644",
|
|
46
|
+
"agent": "worktree-manager",
|
|
47
|
+
"session_id": "claude-session-xyz",
|
|
48
|
+
"task": "Create worktree for issue 115",
|
|
49
|
+
"outcome": "partial_success",
|
|
50
|
+
"issues": [
|
|
51
|
+
{
|
|
52
|
+
"type": "path_error",
|
|
53
|
+
"description": "Failed to cd to relative path from wrong directory",
|
|
54
|
+
"context": "Shell reset to startup directory after git worktree add",
|
|
55
|
+
"impact": "high"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"successes": [
|
|
59
|
+
{
|
|
60
|
+
"type": "worktree_created",
|
|
61
|
+
"description": "Successfully created worktree with correct branch naming"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"suggestions": [
|
|
65
|
+
"Always use absolute paths for directory changes",
|
|
66
|
+
"Store and restore CLAUDE_WORKING_DIR after shell resets"
|
|
67
|
+
],
|
|
68
|
+
"execution_time_ms": 3500,
|
|
69
|
+
"tools_used": ["Bash", "TodoWrite"],
|
|
70
|
+
"error_recovery": true
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 🔄 Learning Loop Process
|
|
75
|
+
|
|
76
|
+
### 1. Immediate Feedback (During Execution)
|
|
77
|
+
|
|
78
|
+
When an agent encounters an issue:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Agent should log the issue immediately
|
|
82
|
+
echo '{
|
|
83
|
+
"timestamp": "'$(date -Iseconds)'",
|
|
84
|
+
"agent": "worktree-manager",
|
|
85
|
+
"issue": "cd failed due to shell reset",
|
|
86
|
+
"recovery": "using absolute path instead"
|
|
87
|
+
}' >> ~/.claude/feedback/logs/$(date +%Y-%m-%d)-worktree-manager.json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 2. Post-Execution Analysis
|
|
91
|
+
|
|
92
|
+
After each agent run, analyze what happened:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
# Pseudocode for analysis
|
|
96
|
+
def analyze_agent_execution(agent_name, session_id):
|
|
97
|
+
# Collect all logs from session
|
|
98
|
+
logs = load_logs(agent_name, session_id)
|
|
99
|
+
|
|
100
|
+
# Identify patterns
|
|
101
|
+
patterns = {
|
|
102
|
+
"repeated_errors": find_repeated_errors(logs),
|
|
103
|
+
"recovery_strategies": extract_successful_recoveries(logs),
|
|
104
|
+
"performance_issues": identify_slow_operations(logs)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
# Generate learnings
|
|
108
|
+
learnings = generate_learnings(patterns)
|
|
109
|
+
|
|
110
|
+
# Update agent instructions if needed
|
|
111
|
+
if should_update_agent(learnings):
|
|
112
|
+
update_agent_instructions(agent_name, learnings)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 3. Learning Extraction
|
|
116
|
+
|
|
117
|
+
Convert feedback into actionable learnings:
|
|
118
|
+
|
|
119
|
+
```markdown
|
|
120
|
+
## Learnings for worktree-manager
|
|
121
|
+
|
|
122
|
+
### Issue: Shell Directory Reset (Encountered 5 times)
|
|
123
|
+
|
|
124
|
+
**Problem**: After `git worktree add`, the shell resets to CLAUDE_STARTUP_DIR
|
|
125
|
+
|
|
126
|
+
**Root Cause**: Each Bash command runs in isolation, directory context not preserved
|
|
127
|
+
|
|
128
|
+
**Solution**:
|
|
129
|
+
1. Always use absolute paths
|
|
130
|
+
2. Export and restore CLAUDE_WORKING_DIR
|
|
131
|
+
3. Chain commands with && when context matters
|
|
132
|
+
|
|
133
|
+
**Updated Instruction**:
|
|
134
|
+
```bash
|
|
135
|
+
# OLD (problematic)
|
|
136
|
+
git worktree add ../work/feat-123 -b feat/123
|
|
137
|
+
cd ../work/feat-123
|
|
138
|
+
|
|
139
|
+
# NEW (reliable)
|
|
140
|
+
WORK_DIR="/absolute/path/to/work/feat-123"
|
|
141
|
+
git worktree add "$WORK_DIR" -b feat/123
|
|
142
|
+
cd "$WORK_DIR" && export CLAUDE_WORKING_DIR=$(pwd)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Issue: Permission Errors on Windows (Encountered 3 times)
|
|
146
|
+
|
|
147
|
+
**Problem**: chmod operations fail silently on Windows
|
|
148
|
+
|
|
149
|
+
**Solution**: Add platform detection and conditional chmod
|
|
150
|
+
|
|
151
|
+
**Updated Instruction**: Check OS before chmod operations
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## 🚀 Implementation Strategy
|
|
157
|
+
|
|
158
|
+
### Phase 1: Manual Feedback Collection
|
|
159
|
+
|
|
160
|
+
1. Create feedback directory structure
|
|
161
|
+
2. Manually log issues during agent execution
|
|
162
|
+
3. Weekly review of feedback logs
|
|
163
|
+
4. Manual updates to agent instructions
|
|
164
|
+
|
|
165
|
+
### Phase 2: Semi-Automated Collection
|
|
166
|
+
|
|
167
|
+
1. Add feedback hooks to agent templates
|
|
168
|
+
2. Automatic JSON logging of issues
|
|
169
|
+
3. Simple analysis scripts to find patterns
|
|
170
|
+
4. Suggested updates for human review
|
|
171
|
+
|
|
172
|
+
### Phase 3: Full Learning Loop
|
|
173
|
+
|
|
174
|
+
1. Real-time feedback collection
|
|
175
|
+
2. Automatic pattern detection
|
|
176
|
+
3. A/B testing of instruction changes
|
|
177
|
+
4. Continuous improvement metrics
|
|
178
|
+
|
|
179
|
+
## 📊 Success Metrics
|
|
180
|
+
|
|
181
|
+
Track these metrics to measure improvement:
|
|
182
|
+
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"agent": "worktree-manager",
|
|
186
|
+
"period": "2025-01",
|
|
187
|
+
"metrics": {
|
|
188
|
+
"success_rate": 0.85,
|
|
189
|
+
"error_recovery_rate": 0.92,
|
|
190
|
+
"avg_execution_time_ms": 2500,
|
|
191
|
+
"unique_errors": 3,
|
|
192
|
+
"repeated_errors": 1,
|
|
193
|
+
"instruction_updates": 2,
|
|
194
|
+
"user_interventions_required": 0.15
|
|
195
|
+
},
|
|
196
|
+
"improvements": {
|
|
197
|
+
"success_rate_change": "+0.10",
|
|
198
|
+
"execution_time_change": "-500ms",
|
|
199
|
+
"error_reduction": "-40%"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## 🔧 Quick Fixes Based on Current Issues
|
|
205
|
+
|
|
206
|
+
### For worktree-manager
|
|
207
|
+
|
|
208
|
+
1. **Always use absolute paths**
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
MAIN_REPO="/home/mark/GitHub/pyeye-mcp"
|
|
212
|
+
WORK_DIR="$MAIN_REPO-work/feat-123"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
2. **Preserve context across commands**
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
export CLAUDE_WORKING_DIR=$(pwd)
|
|
219
|
+
# After any directory change:
|
|
220
|
+
cd "$SOME_DIR" && export CLAUDE_WORKING_DIR=$(pwd)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
3. **Check before assuming**
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
# Don't assume worktree creation succeeded
|
|
227
|
+
if git worktree add "$WORK_DIR" -b "$BRANCH"; then
|
|
228
|
+
cd "$WORK_DIR"
|
|
229
|
+
else
|
|
230
|
+
echo "Failed to create worktree"
|
|
231
|
+
exit 1
|
|
232
|
+
fi
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### For all agents
|
|
236
|
+
|
|
237
|
+
1. **Error handling first**
|
|
238
|
+
- Check command success before proceeding
|
|
239
|
+
- Log failures with context
|
|
240
|
+
- Provide recovery strategies
|
|
241
|
+
|
|
242
|
+
2. **Platform awareness**
|
|
243
|
+
- Test for OS-specific behaviors
|
|
244
|
+
- Use cross-platform alternatives
|
|
245
|
+
- Document platform limitations
|
|
246
|
+
|
|
247
|
+
3. **State validation**
|
|
248
|
+
- Verify assumptions before operations
|
|
249
|
+
- Check current directory, branch, etc.
|
|
250
|
+
- Report state clearly to user
|
|
251
|
+
|
|
252
|
+
## 📚 Knowledge Sharing
|
|
253
|
+
|
|
254
|
+
### Cross-Agent Learnings
|
|
255
|
+
|
|
256
|
+
Some learnings apply to multiple agents:
|
|
257
|
+
|
|
258
|
+
```markdown
|
|
259
|
+
## Universal Agent Learnings
|
|
260
|
+
|
|
261
|
+
### Shell Context Management
|
|
262
|
+
- Applies to: ALL agents using Bash
|
|
263
|
+
- Learning: Shell resets between commands
|
|
264
|
+
- Solution: Export critical variables, use absolute paths
|
|
265
|
+
|
|
266
|
+
### Git Operations
|
|
267
|
+
- Applies to: worktree-manager, smart-commit, pr-workflow
|
|
268
|
+
- Learning: Git commands can fail silently
|
|
269
|
+
- Solution: Always check exit codes, parse output
|
|
270
|
+
|
|
271
|
+
### File System Operations
|
|
272
|
+
- Applies to: ALL agents
|
|
273
|
+
- Learning: Relative paths are unreliable
|
|
274
|
+
- Solution: Resolve to absolute paths early
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## 🎯 Next Steps
|
|
278
|
+
|
|
279
|
+
1. **Immediate**: Update worktree-manager with absolute path usage
|
|
280
|
+
2. **This Week**: Create feedback logging function for all agents
|
|
281
|
+
3. **This Month**: Build analysis tool to find patterns
|
|
282
|
+
4. **This Quarter**: Implement automatic instruction updates
|
|
283
|
+
|
|
284
|
+
## 📝 Template for Agent Updates
|
|
285
|
+
|
|
286
|
+
When updating an agent based on learnings:
|
|
287
|
+
|
|
288
|
+
```markdown
|
|
289
|
+
## Update: [Agent Name] - [Date]
|
|
290
|
+
|
|
291
|
+
### Issue Addressed
|
|
292
|
+
[Description of the problem]
|
|
293
|
+
|
|
294
|
+
### Root Cause
|
|
295
|
+
[Why it happened]
|
|
296
|
+
|
|
297
|
+
### Solution Implemented
|
|
298
|
+
[What was changed]
|
|
299
|
+
|
|
300
|
+
### Test Case
|
|
301
|
+
[How to verify the fix works]
|
|
302
|
+
|
|
303
|
+
### Rollback Plan
|
|
304
|
+
[How to revert if issues arise]
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## 🔍 Monitoring & Alerts
|
|
308
|
+
|
|
309
|
+
Set up monitoring for critical agent failures:
|
|
310
|
+
|
|
311
|
+
1. **Failure threshold**: Alert if success rate < 70%
|
|
312
|
+
2. **Repeated errors**: Alert if same error occurs 3+ times
|
|
313
|
+
3. **Performance degradation**: Alert if execution time increases 50%
|
|
314
|
+
4. **User intervention**: Alert if manual fixes required > 25%
|
|
315
|
+
|
|
316
|
+
## 🤝 Contributing to Agent Improvement
|
|
317
|
+
|
|
318
|
+
When you encounter an agent issue:
|
|
319
|
+
|
|
320
|
+
1. **Document it** in the feedback log
|
|
321
|
+
2. **Attempt recovery** and note what worked
|
|
322
|
+
3. **Suggest improvement** in the feedback
|
|
323
|
+
4. **Update instructions** if you have a fix
|
|
324
|
+
5. **Share learning** in the learnings file
|
|
325
|
+
|
|
326
|
+
Remember: Every issue is an opportunity for the system to improve!
|