alpiecode 10.9.7__tar.gz → 10.9.9__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.
Files changed (141) hide show
  1. {alpiecode-10.9.7 → alpiecode-10.9.9}/PKG-INFO +1 -1
  2. {alpiecode-10.9.7 → alpiecode-10.9.9}/pyproject.toml +1 -1
  3. {alpiecode-10.9.7 → alpiecode-10.9.9}/setup.py +5 -4
  4. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/alpiecode.egg-info/PKG-INFO +1 -1
  5. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/alpiecode.egg-info/SOURCES.txt +3 -0
  6. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/__init__.py +1 -1
  7. alpiecode-10.9.9/src/codeagent/__main__.py +9 -0
  8. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/assessment.py +2 -1
  9. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/backends/local_backend.py +2 -2
  10. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/blueprints.py +21 -3
  11. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/compaction.py +21 -3
  12. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/discovery.py +85 -3
  13. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/memory.py +185 -9
  14. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/onboarding.py +199 -73
  15. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/orchestrator.py +71 -7
  16. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/prompt.py +189 -4
  17. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/tools.py +34 -0
  18. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/verifier.py +167 -64
  19. alpiecode-10.9.9/test/test_frontier_architecture.py +209 -0
  20. alpiecode-10.9.9/test/test_memory_optimization.py +237 -0
  21. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_onboarding.py +71 -39
  22. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_verifier.py +33 -0
  23. {alpiecode-10.9.7 → alpiecode-10.9.9}/README.md +0 -0
  24. {alpiecode-10.9.7 → alpiecode-10.9.9}/setup.cfg +0 -0
  25. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/alpiecode/__init__.py +0 -0
  26. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/alpiecode.egg-info/dependency_links.txt +0 -0
  27. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/alpiecode.egg-info/entry_points.txt +0 -0
  28. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/alpiecode.egg-info/requires.txt +0 -0
  29. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/alpiecode.egg-info/top_level.txt +0 -0
  30. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/agent.py +0 -0
  31. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/backends/__init__.py +0 -0
  32. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/backends/base.py +0 -0
  33. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/backends/openai_backend.py +0 -0
  34. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/cache.py +0 -0
  35. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/cli.py +0 -0
  36. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/client.py +0 -0
  37. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/config.py +0 -0
  38. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/context.py +0 -0
  39. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/diff_preview.py +0 -0
  40. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/doctor.py +0 -0
  41. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/dream_rsi.py +0 -0
  42. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/executor.py +0 -0
  43. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/git_ops.py +0 -0
  44. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/github.py +0 -0
  45. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/guardian.py +0 -0
  46. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/guardrails.py +0 -0
  47. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/ipython_ext.py +0 -0
  48. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/local_model.py +0 -0
  49. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/media.py +0 -0
  50. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/metrics.py +0 -0
  51. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/paths.py +0 -0
  52. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/progress.py +0 -0
  53. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/project_template.py +0 -0
  54. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/rephraser.py +0 -0
  55. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/server.py +0 -0
  56. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/session.py +0 -0
  57. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/accessibility-audit/SKILL.md +0 -0
  58. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/accessibility-testing/SKILL.md +0 -0
  59. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/accessibility-ui-components/SKILL.md +0 -0
  60. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/agentic-workflows/SKILL.md +0 -0
  61. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/api-design/SKILL.md +0 -0
  62. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/architecture-design/SKILL.md +0 -0
  63. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/backend-engineering/SKILL.md +0 -0
  64. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/browser-automation/SKILL.md +0 -0
  65. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/cli-development/SKILL.md +0 -0
  66. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/cloud-infrastructure/SKILL.md +0 -0
  67. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/code-generation/SKILL.md +0 -0
  68. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/code-review/SKILL.md +0 -0
  69. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/codebase-onboarding/SKILL.md +0 -0
  70. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/cost-optimization/SKILL.md +0 -0
  71. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/data-analysis/SKILL.md +0 -0
  72. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/data-engineering/SKILL.md +0 -0
  73. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/database-engineering/SKILL.md +0 -0
  74. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/dependency-management/SKILL.md +0 -0
  75. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/dependency-security/SKILL.md +0 -0
  76. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/dependency-upgrades/SKILL.md +0 -0
  77. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/devops-ci-cd/SKILL.md +0 -0
  78. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/docker-containers/SKILL.md +0 -0
  79. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/documentation/SKILL.md +0 -0
  80. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/documentation-site/SKILL.md +0 -0
  81. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/e2e-testing/SKILL.md +0 -0
  82. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/error-handling-resilience/SKILL.md +0 -0
  83. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/feature-development/SKILL.md +0 -0
  84. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/frontend-engineering/SKILL.md +0 -0
  85. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/git-workflow/SKILL.md +0 -0
  86. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/incident-response/SKILL.md +0 -0
  87. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/legacy-code-modernization/SKILL.md +0 -0
  88. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/llm-application-engineering/SKILL.md +0 -0
  89. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/localization-i18n/SKILL.md +0 -0
  90. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/mcp-server-development/SKILL.md +0 -0
  91. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/migration-engineering/SKILL.md +0 -0
  92. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/mobile-development/SKILL.md +0 -0
  93. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/model-evaluation/SKILL.md +0 -0
  94. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/nodejs-services/SKILL.md +0 -0
  95. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/observability/SKILL.md +0 -0
  96. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/performance-optimization/SKILL.md +0 -0
  97. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/privacy-data-protection/SKILL.md +0 -0
  98. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/prompt-engineering/SKILL.md +0 -0
  99. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/python-engineering/SKILL.md +0 -0
  100. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/rag-retrieval/SKILL.md +0 -0
  101. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/react-engineering/SKILL.md +0 -0
  102. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/release-management/SKILL.md +0 -0
  103. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/requirements-analysis/SKILL.md +0 -0
  104. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/responsive-design/SKILL.md +0 -0
  105. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/safe-refactoring/SKILL.md +0 -0
  106. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/secure-coding/SKILL.md +0 -0
  107. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/systematic-debugging/SKILL.md +0 -0
  108. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/technical-planning/SKILL.md +0 -0
  109. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/technical-research/SKILL.md +0 -0
  110. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/technical-writing/SKILL.md +0 -0
  111. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/test-engineering/SKILL.md +0 -0
  112. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/tool-integration/SKILL.md +0 -0
  113. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/typescript-engineering/SKILL.md +0 -0
  114. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/visual-regression-testing/SKILL.md +0 -0
  115. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/web-performance/SKILL.md +0 -0
  116. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/web-security-testing/SKILL.md +0 -0
  117. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills/workflow-automation/SKILL.md +0 -0
  118. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/skills.py +0 -0
  119. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/slash.py +0 -0
  120. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/subagent.py +0 -0
  121. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/system1.py +0 -0
  122. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/updater.py +0 -0
  123. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/vscode_installer.py +0 -0
  124. {alpiecode-10.9.7 → alpiecode-10.9.9}/src/codeagent/walkthrough.py +0 -0
  125. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_adaptive_resilience.py +0 -0
  126. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_cli_ui.py +0 -0
  127. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_context_and_trajectory.py +0 -0
  128. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_deloop_and_sessions.py +0 -0
  129. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_dream_rsi.py +0 -0
  130. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_gpu_detection.py +0 -0
  131. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_lifecycle_and_portfolio.py +0 -0
  132. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_local_model_download.py +0 -0
  133. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_non_thinking_and_local_stream.py +0 -0
  134. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_project_templates.py +0 -0
  135. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_skills_engine.py +0 -0
  136. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_slash_and_diff.py +0 -0
  137. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_subagents.py +0 -0
  138. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_task_assessment.py +0 -0
  139. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_truncation_resilience.py +0 -0
  140. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_walkthrough.py +0 -0
  141. {alpiecode-10.9.7 → alpiecode-10.9.9}/test/test_web_resilience_and_guardrails.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 10.9.7
3
+ Version: 10.9.9
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "alpiecode"
7
- version = "10.9.7"
7
+ version = "10.9.9"
8
8
  description = "AlpieCode"
9
9
  requires-python = ">=3.9"
10
10
  dependencies = [
@@ -11,11 +11,12 @@ from setuptools.command.develop import develop
11
11
 
12
12
 
13
13
  def _run_post_install():
14
- # Only run onboarding if executed in an interactive terminal session
14
+ # Only run onboarding if executed in an interactive terminal session and not CI/upgrade
15
15
  try:
16
- if sys.stdin and getattr(sys.stdin, "isatty", lambda: False)() and \
17
- sys.stdout and getattr(sys.stdout, "isatty", lambda: False)():
18
- from codeagent.onboarding import prompt_local_model_onboarding
16
+ if any(os.environ.get(k) == "1" for k in ("CI", "CONTINUOUS_INTEGRATION", "ALPIECODE_NO_ONBOARDING")):
17
+ return
18
+ from codeagent.onboarding import prompt_local_model_onboarding, is_fresh_installation
19
+ if is_fresh_installation():
19
20
  prompt_local_model_onboarding()
20
21
  except Exception:
21
22
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 10.9.7
3
+ Version: 10.9.9
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -9,6 +9,7 @@ src/alpiecode.egg-info/entry_points.txt
9
9
  src/alpiecode.egg-info/requires.txt
10
10
  src/alpiecode.egg-info/top_level.txt
11
11
  src/codeagent/__init__.py
12
+ src/codeagent/__main__.py
12
13
  src/codeagent/agent.py
13
14
  src/codeagent/assessment.py
14
15
  src/codeagent/blueprints.py
@@ -120,9 +121,11 @@ test/test_cli_ui.py
120
121
  test/test_context_and_trajectory.py
121
122
  test/test_deloop_and_sessions.py
122
123
  test/test_dream_rsi.py
124
+ test/test_frontier_architecture.py
123
125
  test/test_gpu_detection.py
124
126
  test/test_lifecycle_and_portfolio.py
125
127
  test/test_local_model_download.py
128
+ test/test_memory_optimization.py
126
129
  test/test_non_thinking_and_local_stream.py
127
130
  test/test_onboarding.py
128
131
  test/test_project_templates.py
@@ -17,7 +17,7 @@ Supports:
17
17
  from pathlib import Path
18
18
  from typing import Optional, Any, Dict
19
19
 
20
- __version__ = "10.9.7"
20
+ __version__ = "10.9.9"
21
21
 
22
22
  def run(task: str, workdir: str = ".", reasoning_level: str = "thinking", **kwargs):
23
23
  """Run an autonomous coding task programmatically."""
@@ -0,0 +1,9 @@
1
+ """
2
+ Entrypoint for `python -m codeagent`
3
+ """
4
+
5
+ import sys
6
+ from codeagent.cli import main
7
+
8
+ if __name__ == "__main__":
9
+ main()
@@ -152,9 +152,10 @@ _DEBUG_INDICATORS = [
152
152
 
153
153
  _MODIFY_INDICATORS = [
154
154
  r"\b(modify|update|change|refactor|restructure|reorganize)\b",
155
- r"\b(add\s+feature|extend|integrate|migrate|upgrade|optimize|improve)\b",
155
+ r"\b(add\s+feature|extend|integrate|migrate|upgrade|optimize|improve|redesign|enhance|modernize|revamp)\b",
156
156
  r"\b(convert|transform|replace|swap|rename|remove\s+from|delete\s+from)\b",
157
157
  r"\b(add\s+endpoint|add\s+route|add\s+method|add\s+support\s+for)\b",
158
+ r"\b(better\s+website|make\s+.*better|made\s+better|make\s+better|of\s+it|to\s+it)\b",
158
159
  ]
159
160
 
160
161
  _STANDALONE_ALGORITHMS = {
@@ -177,8 +177,8 @@ class LocalBackend:
177
177
  c_text = coalesced[-1].get("content", "")
178
178
  if any(k in c_text for k in ("[Tool Result", "[Workspace State", "Files created so far", "[CRITICAL STYLING DIRECTIVE")):
179
179
  prompt_hint = (
180
- "\n\n[Next Action: Output your next <tool_call> (e.g. write_file or bash) immediately. "
181
- "Do NOT output conversational text. When all files are created and verified, output: DONE: <summary>.]"
180
+ "\n\n[Next Action: Output your next <tool_call> (e.g. write_file, edit_file, or bash) immediately. "
181
+ "Do NOT output conversational text. When all files are created and verified, call complete_task or output: DONE: <summary>.]"
182
182
  )
183
183
  if "[Next Action:" not in c_text:
184
184
  coalesced[-1]["content"] += prompt_hint
@@ -11,7 +11,8 @@ Binds concrete, unambiguous engineering blueprints to user tasks:
11
11
 
12
12
  from dataclasses import dataclass, field
13
13
  from enum import Enum
14
- from typing import Dict, List, Optional
14
+ from pathlib import Path
15
+ from typing import Dict, List, Optional, Union
15
16
 
16
17
 
17
18
  class BlueprintType(str, Enum):
@@ -564,10 +565,27 @@ def resolve_domain_blueprint(task: str, repo: Optional[Dict] = None, intent: str
564
565
 
565
566
  # ── Interactive Web Framework Selection ───────────────────────────────
566
567
 
567
- def is_ambiguous_web_task(task: str) -> bool:
568
- """Return True if user asks to create a website without specifying a tech stack."""
568
+ def is_ambiguous_web_task(task: str, workdir: Optional[Union[Path, str]] = None) -> bool:
569
+ """Return True if user asks to create a website from scratch without specifying a tech stack."""
569
570
  t = task.lower().strip()
570
571
 
572
+ # If modifying, enhancing, or working on an existing site, do not prompt for stack
573
+ _ENHANCE_WORDS = (
574
+ "better", "improve", "enhance", "redesign", "update", "modify", "change",
575
+ "of it", "to it", "this site", "this website", "existing", "fix", "debug",
576
+ "revamp", "modernize", "polish", "made better",
577
+ )
578
+ if any(w in t for w in _ENHANCE_WORDS):
579
+ return False
580
+
581
+ if workdir is not None:
582
+ try:
583
+ p = Path(workdir).resolve()
584
+ if (p / "index.html").is_file() or (p / "package.json").is_file() or (p / "public" / "index.html").is_file():
585
+ return False
586
+ except Exception:
587
+ pass
588
+
571
589
  web_nouns = ("website", "web app", "webapp", "web page", "webpage", "web application", "landing page", "store", "portal")
572
590
  action_words = ("create", "build", "make", "develop", "generate", "code", "write", "setup", "start")
573
591
 
@@ -285,14 +285,32 @@ def compact_tool_calls(tool_calls: List[Any]) -> List[Any]:
285
285
  continue
286
286
  name = fn.get("name", "")
287
287
  raw_args = fn.get("arguments", "")
288
- if name in ("write_file", "edit_file", "apply_patch"):
288
+ if name in ("write_file", "edit_file", "append_file", "apply_patch"):
289
289
  try:
290
290
  args = json.loads(raw_args) if isinstance(raw_args, str) else dict(raw_args)
291
- content = args.get("content") or args.get("patch") or ""
292
- path = args.get("path") or args.get("filename") or "file"
291
+ path = args.get("path") or args.get("filename") or args.get("file") or "file"
292
+ changed = False
293
+
294
+ content = args.get("content") or args.get("patch")
293
295
  if isinstance(content, str) and len(content) > 150:
294
296
  lines = content.splitlines()
295
297
  args["content"] = f"[Content saved to {path} ({len(lines)} lines, {len(content)} bytes)]"
298
+ changed = True
299
+
300
+ new_str = args.get("new_str") or args.get("new_string") or args.get("replacement") or args.get("code")
301
+ if isinstance(new_str, str) and len(new_str) > 150:
302
+ lines = new_str.splitlines()
303
+ k = "new_str" if "new_str" in args else ("new_string" if "new_string" in args else ("replacement" if "replacement" in args else "code"))
304
+ args[k] = f"[Replacement code applied to {path} ({len(lines)} lines)]"
305
+ changed = True
306
+
307
+ old_str = args.get("old_str") or args.get("old_string") or args.get("target")
308
+ if isinstance(old_str, str) and len(old_str) > 150:
309
+ k = "old_str" if "old_str" in args else ("old_string" if "old_string" in args else "target")
310
+ args[k] = f"[Target lines replaced in {path}]"
311
+ changed = True
312
+
313
+ if changed:
296
314
  compact_tc = dict(tc)
297
315
  compact_tc["function"] = dict(fn)
298
316
  compact_tc["function"]["arguments"] = json.dumps(args) if isinstance(raw_args, str) else args
@@ -30,6 +30,8 @@ from .assessment import TaskAssessment, assess_task, ExecutionStrategy
30
30
  class TaskContext:
31
31
  """Pre-computed intelligence about the task and environment."""
32
32
 
33
+ task: str = ""
34
+
33
35
  # Assessment & Strategy
34
36
  assessment: Optional[Any] = None
35
37
  strategy: str = "fast_path" # fast_path or reasoning_path
@@ -100,7 +102,8 @@ _MODIFY_VERBS = [
100
102
  "fix", "add", "modify", "change", "update", "remove", "delete",
101
103
  "refactor", "migrate", "upgrade", "downgrade", "rename",
102
104
  "move", "restructure", "reorganize", "optimize", "improve",
103
- "convert", "transform", "replace", "swap",
105
+ "convert", "transform", "replace", "swap", "redesign", "enhance",
106
+ "modernize", "revamp",
104
107
  ]
105
108
 
106
109
  # Debug verbs
@@ -134,6 +137,16 @@ def detect_intent(task: str) -> str:
134
137
  if t.endswith("?") and not any(re.search(r"\b" + re.escape(av) + r"\b", t) for av in all_action):
135
138
  return "qa"
136
139
 
140
+ # Enhancement / comparative modification patterns (e.g. "make a better website of it", "make it better", "improve the portfolio")
141
+ _ENHANCE_PATTERNS = [
142
+ r"\b(better\s+website|make\s+it\s+.*|make\s+this\s+.*|made\s+better|make\s+better)\b",
143
+ r"\b(improve|redesign|enhance|upgrade|refactor|modernize|revamp|polish)\b",
144
+ r"\b(change\s+and\s+make|modify\s+and\s+make|change\s+and\s+made)\b",
145
+ r"\b(of\s+it|to\s+it|existing\s+website|this\s+website|this\s+site)\b",
146
+ ]
147
+ if any(re.search(pat, t) for pat in _ENHANCE_PATTERNS):
148
+ return "modify"
149
+
137
150
  # Check if task starts with a create verb ("build a...", "create a...", "write a...")
138
151
  if any(t.startswith(cv) for cv in ["build", "create", "write", "make", "implement", "develop", "generate", "code", "design"]):
139
152
  return "create"
@@ -332,14 +345,57 @@ def _detect_project(workdir: Path) -> Tuple[str, List[str]]:
332
345
  if (workdir / "pom.xml").exists() or (workdir / "build.gradle").exists():
333
346
  return "java", []
334
347
 
348
+ # Web / Frontend indicators (HTML / CSS / JS static app)
349
+ if (workdir / "index.html").exists() or (workdir / "public" / "index.html").exists():
350
+ frameworks = _detect_web_frameworks(workdir)
351
+ return "web", frameworks
352
+
335
353
  # Check if there are any source files at all
336
- for ext in (".py", ".js", ".ts", ".rs", ".go", ".java", ".c", ".cpp"):
354
+ for ext in (".html", ".py", ".js", ".ts", ".rs", ".go", ".java", ".c", ".cpp"):
337
355
  for _ in workdir.glob(f"*{ext}"):
356
+ if ext == ".html":
357
+ return "web", ["html5"]
338
358
  return "unknown", []
339
359
 
340
360
  return "empty", []
341
361
 
342
362
 
363
+ def _detect_web_frameworks(workdir: Path) -> List[str]:
364
+ """Detect web frameworks and conventions from HTML/CSS/JS files."""
365
+ frameworks = ["html5", "css3", "vanilla_js"]
366
+ index_html = workdir / "index.html"
367
+ if not index_html.exists():
368
+ index_html = workdir / "public" / "index.html"
369
+
370
+ content = ""
371
+ if index_html.exists():
372
+ try:
373
+ content = index_html.read_text(errors="replace").lower()
374
+ except Exception:
375
+ pass
376
+
377
+ styles_css = workdir / "styles.css"
378
+ if styles_css.exists():
379
+ try:
380
+ content += " " + styles_css.read_text(errors="replace").lower()
381
+ except Exception:
382
+ pass
383
+
384
+ detected = []
385
+ if "cdn.tailwindcss.com" in content or "tailwind" in content:
386
+ detected.append("tailwind")
387
+ if "bootstrap" in content:
388
+ detected.append("bootstrap")
389
+ if "fontawesome" in content or "font-awesome" in content:
390
+ detected.append("font-awesome")
391
+ if "react" in content:
392
+ detected.append("react")
393
+ if "vue" in content:
394
+ detected.append("vue")
395
+
396
+ return detected if detected else frameworks
397
+
398
+
343
399
  def _detect_python_frameworks(workdir: Path) -> List[str]:
344
400
  """Detect Python frameworks from requirements/pyproject."""
345
401
  frameworks = []
@@ -406,10 +462,11 @@ def _detect_node_frameworks(workdir: Path) -> List[str]:
406
462
  def _find_entry_points(workdir: Path, project_type: str) -> List[str]:
407
463
  """Find likely entry point files."""
408
464
  entry_names = [
465
+ "index.html", "public/index.html",
409
466
  "main.py", "app.py", "server.py", "manage.py", "run.py",
410
467
  "index.py", "cli.py", "__main__.py",
411
468
  "index.js", "index.ts", "app.js", "app.ts", "server.js", "server.ts",
412
- "main.go", "main.rs", "Main.java",
469
+ "styles.css", "main.go", "main.rs", "Main.java",
413
470
  ]
414
471
  found = []
415
472
  for name in entry_names:
@@ -575,6 +632,21 @@ def gather_relevant_context(
575
632
  for rel, label in config_files:
576
633
  _add_file(rel, label)
577
634
 
635
+ # -- Priority 1.5: Project Architecture Snapshot (Deterministic Memory) --
636
+ try:
637
+ from .memory import generate_project_architecture_snapshot
638
+ snapshot = generate_project_architecture_snapshot(workdir, max_chars=800)
639
+ if snapshot:
640
+ sections.append(f"### Existing Project Snapshot (Deterministic Memory)\n{snapshot}")
641
+ except Exception:
642
+ pass
643
+
644
+ # -- Priority 1.6: Web deliverables if web project --
645
+ if getattr(task_context, "project_type", "") == "web" or (workdir / "index.html").is_file():
646
+ _add_file("index.html", "index.html (HTML markup)")
647
+ _add_file("styles.css", "styles.css (Styles & tokens)")
648
+ _add_file("app.js", "app.js (Interactions & state)")
649
+
578
650
  # -- Priority 2: Entry points (helps understand project structure) --
579
651
  if task_context.intent in ("modify", "debug", "create"):
580
652
  for ep in task_context.entry_points[:3]:
@@ -696,6 +768,15 @@ def build_task_context(task: str, workdir: Path) -> TaskContext:
696
768
  if assessment.intent:
697
769
  intent = assessment.intent
698
770
 
771
+ # Contextual Intent Refinement for existing codebases
772
+ if repo.get("file_count", 0) > 0 and repo.get("project_type") != "empty":
773
+ t_low = task.lower().strip()
774
+ if any(w in t_low for w in ("better", "improve", "enhance", "redesign", "upgrade", "revamp", "modernize", "of it", "to it", "this website", "this site", "existing")):
775
+ intent = "modify"
776
+ elif (workdir / "index.html").exists() and any(w in t_low for w in ("website", "portfolio", "page", "app", "site")) and not any(w in t_low for w in ("scratch", "brand new", "from scratch")):
777
+ if any(w in t_low for w in ("change", "made", "update", "add", "style", "fix", "theme", "dark", "light", "better", "make")):
778
+ intent = "modify"
779
+
699
780
  # Phase 5: Budget from complexity
700
781
  budget = COMPLEXITY_CONFIG.get(complexity, COMPLEXITY_CONFIG["low"])
701
782
  enable_thinking = budget["enable_thinking"]
@@ -738,6 +819,7 @@ def build_task_context(task: str, workdir: Path) -> TaskContext:
738
819
  project_profile = "standard"
739
820
 
740
821
  return TaskContext(
822
+ task=task,
741
823
  symbol_index=symbol_index,
742
824
  # Assessment & Strategy
743
825
  assessment=assessment,
@@ -129,13 +129,21 @@ def format_memories_for_prompt(
129
129
 
130
130
  lines = ["## Recalled memories from previous sessions on this project:"]
131
131
  total_chars = 0
132
- # Use most recent memories first, single-line summarized to keep prompt lean
132
+ # Use most recent memories first, summarized cleanly to keep prompt lean without losing substance
133
133
  for mem in reversed(memories):
134
134
  c = mem.get("content", "").strip()
135
135
  if not c:
136
136
  continue
137
- first_line = c.split("\n")[0][:120]
138
- entry = f"- [{mem.get('type', 'note')}] {first_line}"
137
+ m_type = mem.get("type", "note")
138
+
139
+ # Format cleanly preserving multi-line substance
140
+ if "\n" in c:
141
+ collapsed = " ".join(line.strip() for line in c.splitlines() if line.strip())
142
+ entry_body = collapsed[:220]
143
+ else:
144
+ entry_body = c[:220]
145
+
146
+ entry = f"- [{m_type}] {entry_body}"
139
147
  if total_chars + len(entry) > max_chars:
140
148
  break
141
149
  lines.append(entry)
@@ -148,28 +156,178 @@ def format_memories_for_prompt(
148
156
 
149
157
  lines.append(
150
158
  "\nNote: These memories are from previous sessions. "
151
- "Verify they are still accurate before relying on them."
159
+ "Preserve existing architecture, branding, and deliverables."
152
160
  )
153
161
  return "\n".join(lines)
154
162
 
155
163
 
164
+ def generate_project_architecture_snapshot(
165
+ workdir: Union[Path, str],
166
+ max_chars: int = 1200,
167
+ ) -> Optional[str]:
168
+ """
169
+ Extract a fast, deterministic structural snapshot of the project on disk.
170
+ Captures:
171
+ - Web: Page title, semantic sections, declared element IDs, CSS variables (:root), themes, JS functions.
172
+ - Python/Node: Entry points, key classes, routes, and functions.
173
+ Returns a clean markdown snippet (~150-250 tokens), or None if no project files exist.
174
+ """
175
+ workdir = Path(workdir).resolve()
176
+ if not workdir.exists():
177
+ return None
178
+
179
+ lines = []
180
+ import re
181
+
182
+ # ── 1. Static Web Projects (HTML / CSS / JS) ──
183
+ index_html = workdir / "index.html"
184
+ if not index_html.is_file():
185
+ index_html = workdir / "public" / "index.html"
186
+
187
+ if index_html.is_file():
188
+ try:
189
+ html_content = index_html.read_text(errors="replace")
190
+ # Page Title
191
+ m_title = re.search(r"<title[^>]*>(.*?)</title>", html_content, re.IGNORECASE | re.DOTALL)
192
+ title = m_title.group(1).strip() if m_title else ""
193
+ if title:
194
+ lines.append(f"- **Page Title**: \"{title}\"")
195
+
196
+ # Landmarks & Semantic Sections
197
+ landmarks = []
198
+ for tag in ("header", "nav", "main", "footer", "aside"):
199
+ if f"<{tag}" in html_content.lower():
200
+ landmarks.append(f"<{tag}>")
201
+ section_ids = re.findall(r"<section[^>]*id=[\"']([^\"']+)[\"']", html_content, re.IGNORECASE)
202
+ for sid in section_ids[:8]:
203
+ landmarks.append(f"<section id=\"{sid}\">")
204
+ if landmarks:
205
+ lines.append(f"- **Key Sections**: {', '.join(landmarks[:10])}")
206
+
207
+ # Declared Element IDs (crucial for JS bindings and avoiding DOM drift)
208
+ all_ids = re.findall(r"\bid=[\"']([^\"']+)[\"']", html_content)
209
+ seen_ids = []
210
+ for item in all_ids:
211
+ if item not in seen_ids:
212
+ seen_ids.append(item)
213
+ if seen_ids:
214
+ formatted_ids = [f"#{i}" for i in seen_ids[:15]]
215
+ lines.append(f"- **Declared DOM IDs**: {', '.join(formatted_ids)}")
216
+ except Exception:
217
+ pass
218
+
219
+ # Inspect styles.css
220
+ styles_css = workdir / "styles.css"
221
+ if styles_css.is_file():
222
+ try:
223
+ css_content = styles_css.read_text(errors="replace")
224
+ root_vars = re.findall(r"(--[a-zA-Z0-9_-]+)\s*:", css_content)
225
+ seen_vars = []
226
+ for v in root_vars:
227
+ if v not in seen_vars:
228
+ seen_vars.append(v)
229
+ if seen_vars:
230
+ lines.append(f"- **CSS Design Tokens (:root)**: {', '.join(seen_vars[:12])}")
231
+ themes = []
232
+ if "data-theme" in css_content:
233
+ themes.append("[data-theme='dark']")
234
+ if ".dark" in css_content:
235
+ themes.append(".dark")
236
+ if themes:
237
+ lines.append(f"- **Supported Themes**: {', '.join(themes)}")
238
+ except Exception:
239
+ pass
240
+
241
+ # Inspect app.js / script.js / main.js
242
+ for js_name in ("app.js", "script.js", "main.js"):
243
+ js_file = workdir / js_name
244
+ if js_file.is_file():
245
+ try:
246
+ js_content = js_file.read_text(errors="replace")
247
+ fn_matches = re.findall(r"(?:function\s+([a-zA-Z0-9_$]+)|(?:const|let|var)\s+([a-zA-Z0-9_$]+)\s*=\s*(?:async\s*)?\()", js_content)
248
+ fn_names = [f[0] or f[1] for f in fn_matches if (f[0] or f[1])]
249
+ seen_fns = []
250
+ for fn in fn_names:
251
+ if fn not in seen_fns:
252
+ seen_fns.append(fn)
253
+ if seen_fns:
254
+ lines.append(f"- **JS Logic ({js_name})**: Functions ({', '.join(seen_fns[:8])})")
255
+
256
+ ls_keys = re.findall(r"localStorage\.(?:getItem|setItem)\([\"']([^\"']+)[\"']", js_content)
257
+ if ls_keys:
258
+ seen_ls = list(dict.fromkeys(ls_keys))
259
+ lines.append(f"- **State Persistence**: localStorage keys ({', '.join(seen_ls[:5])})")
260
+ break
261
+ except Exception:
262
+ pass
263
+
264
+ # ── 2. Python Projects (if present) ──
265
+ for py_name in ("app.py", "main.py", "server.py"):
266
+ py_file = workdir / py_name
267
+ if py_file.is_file() and not index_html.is_file():
268
+ try:
269
+ py_content = py_file.read_text(errors="replace")
270
+ routes = re.findall(r"@(?:app|router)\.(?:get|post|put|delete|patch|route)\([\"']([^\"']+)[\"']", py_content)
271
+ fns = re.findall(r"def\s+([a-zA-Z0-9_]+)\s*\(", py_content)
272
+ classes = re.findall(r"class\s+([a-zA-Z0-9_]+)", py_content)
273
+ parts = []
274
+ if classes:
275
+ parts.append(f"Classes ({', '.join(classes[:5])})")
276
+ if routes:
277
+ parts.append(f"Routes ({', '.join(routes[:6])})")
278
+ elif fns:
279
+ parts.append(f"Functions ({', '.join(fns[:6])})")
280
+ if parts:
281
+ lines.append(f"- **Python Entry ({py_name})**: {'; '.join(parts)}")
282
+ break
283
+ except Exception:
284
+ pass
285
+
286
+ if not lines:
287
+ return None
288
+
289
+ snapshot = "\n".join(lines)
290
+ if len(snapshot) > max_chars:
291
+ snapshot = snapshot[:max_chars].rsplit("\n", 1)[0]
292
+ return snapshot
293
+
294
+
156
295
  def extract_and_save_memories(workdir: Path, messages: list) -> None:
157
296
  """
158
297
  After a session ends, extract key learnings from the conversation
159
298
  and save them as memories in a single atomic batch.
160
299
 
161
- Scans tool results for commonly useful information like:
300
+ Scans tool results and assistant outputs for:
162
301
  - Successful build/test commands
163
- - Project structure (from list_files results)
302
+ - Core deliverables modified/created
303
+ - Project structure
164
304
  - Completion summaries
165
305
  """
166
306
  to_save: List[dict] = []
167
307
  saved_cmds = set() # Avoid duplicate command memories
308
+ touched_deliverables = set()
168
309
 
169
310
  for idx, msg in enumerate(messages):
170
311
  if not isinstance(msg, dict):
171
312
  continue
172
313
 
314
+ # ── Track created or modified deliverables ──
315
+ if msg.get("role") == "assistant" and msg.get("tool_calls"):
316
+ for tc in msg["tool_calls"]:
317
+ tc_dict = tc if isinstance(tc, dict) else {}
318
+ fn = tc_dict.get("function", {})
319
+ fn_name = fn.get("name", "")
320
+ if fn_name in ("write_file", "edit_file", "append_file"):
321
+ try:
322
+ args = fn.get("arguments", "{}")
323
+ if isinstance(args, str):
324
+ args = json.loads(args)
325
+ fp = args.get("path") or args.get("file_path") or args.get("filename")
326
+ if fp:
327
+ touched_deliverables.add(Path(fp).name)
328
+ except Exception:
329
+ pass
330
+
173
331
  # ── Save successful build/test commands ──
174
332
  if msg.get("role") == "tool":
175
333
  content = msg.get("content", "")
@@ -206,9 +364,14 @@ def extract_and_save_memories(workdir: Path, messages: list) -> None:
206
364
 
207
365
  # ── Save completion summaries ──
208
366
  if msg.get("role") == "assistant" and msg.get("content"):
209
- content = msg["content"]
210
- if content.strip().startswith("DONE"):
211
- to_save.append({"content": content.strip()[:200], "type": "completion_summary"})
367
+ content = msg["content"].strip()
368
+ if content.startswith("DONE"):
369
+ clean_done = " ".join(content.split())[:350]
370
+ to_save.append({"content": clean_done, "type": "completion_summary"})
371
+
372
+ if touched_deliverables:
373
+ files_str = ", ".join(sorted(list(touched_deliverables)))
374
+ to_save.append({"content": f"Deliverables in project: {files_str}", "type": "deliverables"})
212
375
 
213
376
  if to_save:
214
377
  save_memories_batch(workdir, to_save)
@@ -242,6 +405,19 @@ def read_project_session(workdir: Path) -> Optional[dict]:
242
405
  if m_status:
243
406
  result["status"] = m_status.group(1).strip()
244
407
 
408
+ m_findings = re.search(r"##\s*Current Findings\s*\n+([^\n#]+)", text, re.IGNORECASE)
409
+ if m_findings:
410
+ result["findings"] = m_findings.group(1).strip()
411
+
412
+ m_changes = re.search(r"##\s*Changes Made\s*\n+(.*?)(?=\n##|\Z)", text, re.DOTALL | re.IGNORECASE)
413
+ if m_changes:
414
+ changes_block = m_changes.group(1).strip()
415
+ result["changes_made"] = [
416
+ line.strip().lstrip("0123456789.-* ")
417
+ for line in changes_block.split("\n")
418
+ if line.strip() and not line.strip().startswith("#")
419
+ ]
420
+
245
421
  m_steps = re.search(r"##\s*Next Steps\s*\n+(.*?)(?=\n##|\Z)", text, re.DOTALL | re.IGNORECASE)
246
422
  if m_steps:
247
423
  steps_block = m_steps.group(1).strip()