klaude-code 2.7.0__py3-none-any.whl → 2.8.0__py3-none-any.whl
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.
- klaude_code/auth/AGENTS.md +325 -0
- klaude_code/auth/__init__.py +17 -1
- klaude_code/auth/antigravity/__init__.py +20 -0
- klaude_code/auth/antigravity/exceptions.py +17 -0
- klaude_code/auth/antigravity/oauth.py +320 -0
- klaude_code/auth/antigravity/pkce.py +25 -0
- klaude_code/auth/antigravity/token_manager.py +45 -0
- klaude_code/auth/base.py +4 -0
- klaude_code/auth/claude/oauth.py +29 -9
- klaude_code/auth/codex/exceptions.py +4 -0
- klaude_code/cli/auth_cmd.py +53 -3
- klaude_code/cli/cost_cmd.py +83 -160
- klaude_code/cli/list_model.py +50 -0
- klaude_code/cli/main.py +1 -1
- klaude_code/config/assets/builtin_config.yaml +108 -0
- klaude_code/config/builtin_config.py +5 -11
- klaude_code/config/config.py +24 -10
- klaude_code/const.py +1 -0
- klaude_code/core/agent.py +5 -1
- klaude_code/core/agent_profile.py +28 -32
- klaude_code/core/compaction/AGENTS.md +112 -0
- klaude_code/core/compaction/__init__.py +11 -0
- klaude_code/core/compaction/compaction.py +707 -0
- klaude_code/core/compaction/overflow.py +30 -0
- klaude_code/core/compaction/prompts.py +97 -0
- klaude_code/core/executor.py +103 -2
- klaude_code/core/manager/llm_clients.py +5 -0
- klaude_code/core/manager/llm_clients_builder.py +14 -2
- klaude_code/core/prompts/prompt-antigravity.md +80 -0
- klaude_code/core/prompts/prompt-codex-gpt-5-2.md +335 -0
- klaude_code/core/reminders.py +7 -2
- klaude_code/core/task.py +126 -0
- klaude_code/core/tool/todo/todo_write_tool.py +1 -1
- klaude_code/core/turn.py +3 -1
- klaude_code/llm/antigravity/__init__.py +3 -0
- klaude_code/llm/antigravity/client.py +558 -0
- klaude_code/llm/antigravity/input.py +261 -0
- klaude_code/llm/registry.py +1 -0
- klaude_code/protocol/events.py +18 -0
- klaude_code/protocol/llm_param.py +1 -0
- klaude_code/protocol/message.py +23 -1
- klaude_code/protocol/op.py +15 -1
- klaude_code/protocol/op_handler.py +5 -0
- klaude_code/session/session.py +36 -0
- klaude_code/skill/assets/create-plan/SKILL.md +6 -6
- klaude_code/tui/command/__init__.py +3 -0
- klaude_code/tui/command/compact_cmd.py +32 -0
- klaude_code/tui/command/fork_session_cmd.py +110 -14
- klaude_code/tui/command/model_picker.py +5 -1
- klaude_code/tui/command/thinking_cmd.py +1 -1
- klaude_code/tui/commands.py +6 -0
- klaude_code/tui/components/rich/markdown.py +57 -1
- klaude_code/tui/components/rich/theme.py +10 -2
- klaude_code/tui/components/tools.py +39 -25
- klaude_code/tui/components/user_input.py +1 -1
- klaude_code/tui/input/__init__.py +5 -2
- klaude_code/tui/input/drag_drop.py +6 -57
- klaude_code/tui/input/key_bindings.py +10 -0
- klaude_code/tui/input/prompt_toolkit.py +19 -6
- klaude_code/tui/machine.py +25 -0
- klaude_code/tui/renderer.py +67 -4
- klaude_code/tui/runner.py +18 -2
- klaude_code/tui/terminal/image.py +72 -10
- klaude_code/tui/terminal/selector.py +31 -7
- {klaude_code-2.7.0.dist-info → klaude_code-2.8.0.dist-info}/METADATA +1 -1
- {klaude_code-2.7.0.dist-info → klaude_code-2.8.0.dist-info}/RECORD +68 -52
- klaude_code/core/prompts/prompt-codex-gpt-5-1-codex-max.md +0 -117
- {klaude_code-2.7.0.dist-info → klaude_code-2.8.0.dist-info}/WHEEL +0 -0
- {klaude_code-2.7.0.dist-info → klaude_code-2.8.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
_OVERFLOW_PATTERNS = [
|
|
4
|
+
re.compile(r"prompt is too long", re.IGNORECASE),
|
|
5
|
+
re.compile(r"exceeds the context window", re.IGNORECASE),
|
|
6
|
+
re.compile(r"input token count.*exceeds the maximum", re.IGNORECASE),
|
|
7
|
+
re.compile(r"maximum prompt length is \d+", re.IGNORECASE),
|
|
8
|
+
re.compile(r"reduce the length of the messages", re.IGNORECASE),
|
|
9
|
+
re.compile(r"maximum context length is \d+ tokens", re.IGNORECASE),
|
|
10
|
+
re.compile(r"exceeds the limit of \d+", re.IGNORECASE),
|
|
11
|
+
re.compile(r"exceeds the available context size", re.IGNORECASE),
|
|
12
|
+
re.compile(r"greater than the context length", re.IGNORECASE),
|
|
13
|
+
re.compile(r"context length exceeded", re.IGNORECASE),
|
|
14
|
+
re.compile(r"too many tokens", re.IGNORECASE),
|
|
15
|
+
re.compile(r"token limit exceeded", re.IGNORECASE),
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
_STATUS_CODE_PATTERN = re.compile(r"^4(00|13|29)\s*(status code)?\s*\(no body\)", re.IGNORECASE)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def is_context_overflow(error_message: str | None) -> bool:
|
|
22
|
+
if not error_message:
|
|
23
|
+
return False
|
|
24
|
+
if _STATUS_CODE_PATTERN.search(error_message):
|
|
25
|
+
return True
|
|
26
|
+
return any(pattern.search(error_message) for pattern in _OVERFLOW_PATTERNS)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def get_overflow_patterns() -> list[re.Pattern[str]]:
|
|
30
|
+
return list(_OVERFLOW_PATTERNS)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
SUMMARIZATION_SYSTEM_PROMPT = (
|
|
2
|
+
"You are a context summarization assistant. Your task is to read a conversation between a user and an AI "
|
|
3
|
+
"coding assistant, then produce a structured summary following the exact format specified.\n\n"
|
|
4
|
+
"Do NOT continue the conversation. Do NOT respond to any questions in the conversation. ONLY output the "
|
|
5
|
+
"structured summary."
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
SUMMARIZATION_PROMPT = """The messages above are a conversation to summarize. Create a structured context checkpoint summary that another LLM will use to continue the work.
|
|
9
|
+
|
|
10
|
+
Use this EXACT format:
|
|
11
|
+
|
|
12
|
+
## Goal
|
|
13
|
+
[What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
|
|
14
|
+
|
|
15
|
+
## Constraints & Preferences
|
|
16
|
+
- [Any constraints, preferences, or requirements mentioned by user]
|
|
17
|
+
- [Or "(none)" if none were mentioned]
|
|
18
|
+
|
|
19
|
+
## Progress
|
|
20
|
+
### Done
|
|
21
|
+
- [x] [Completed tasks/changes]
|
|
22
|
+
|
|
23
|
+
### In Progress
|
|
24
|
+
- [ ] [Current work]
|
|
25
|
+
|
|
26
|
+
### Blocked
|
|
27
|
+
- [Issues preventing progress, if any]
|
|
28
|
+
|
|
29
|
+
## Key Decisions
|
|
30
|
+
- **[Decision]**: [Brief rationale]
|
|
31
|
+
|
|
32
|
+
## Next Steps
|
|
33
|
+
1. [Ordered list of what should happen next]
|
|
34
|
+
|
|
35
|
+
## Critical Context
|
|
36
|
+
- [Any data, examples, or references needed to continue]
|
|
37
|
+
- [Or "(none)" if not applicable]
|
|
38
|
+
|
|
39
|
+
Keep each section concise. Preserve exact file paths, function names, and error messages."""
|
|
40
|
+
|
|
41
|
+
UPDATE_SUMMARIZATION_PROMPT = """The messages above are NEW conversation messages to incorporate into the existing summary provided in <previous-summary> tags.
|
|
42
|
+
|
|
43
|
+
Update the existing structured summary with new information. RULES:
|
|
44
|
+
- PRESERVE all existing information from the previous summary
|
|
45
|
+
- ADD new progress, decisions, and context from the new messages
|
|
46
|
+
- UPDATE the Progress section: move items from "In Progress" to "Done" when completed
|
|
47
|
+
- UPDATE "Next Steps" based on what was accomplished
|
|
48
|
+
- PRESERVE exact file paths, function names, and error messages
|
|
49
|
+
- If something is no longer relevant, you may remove it
|
|
50
|
+
|
|
51
|
+
Use this EXACT format:
|
|
52
|
+
|
|
53
|
+
## Goal
|
|
54
|
+
[Preserve existing goals, add new ones if the task expanded]
|
|
55
|
+
|
|
56
|
+
## Constraints & Preferences
|
|
57
|
+
- [Preserve existing, add new ones discovered]
|
|
58
|
+
|
|
59
|
+
## Progress
|
|
60
|
+
### Done
|
|
61
|
+
- [x] [Include previously done items AND newly completed items]
|
|
62
|
+
|
|
63
|
+
### In Progress
|
|
64
|
+
- [ ] [Current work - update based on progress]
|
|
65
|
+
|
|
66
|
+
### Blocked
|
|
67
|
+
- [Current blockers - remove if resolved]
|
|
68
|
+
|
|
69
|
+
## Key Decisions
|
|
70
|
+
- **[Decision]**: [Brief rationale] (preserve all previous, add new)
|
|
71
|
+
|
|
72
|
+
## Next Steps
|
|
73
|
+
1. [Update based on current state]
|
|
74
|
+
|
|
75
|
+
## Critical Context
|
|
76
|
+
- [Preserve important context, add new if needed]
|
|
77
|
+
|
|
78
|
+
Keep each section concise. Preserve exact file paths, function names, and error messages."""
|
|
79
|
+
|
|
80
|
+
TASK_PREFIX_SUMMARIZATION_PROMPT = """This is the PREFIX of a task that was too large to keep. The SUFFIX (recent work) is retained.
|
|
81
|
+
|
|
82
|
+
Summarize the prefix to provide context for the retained suffix:
|
|
83
|
+
|
|
84
|
+
## Original Request
|
|
85
|
+
[What did the user ask for in this task?]
|
|
86
|
+
|
|
87
|
+
## Early Progress
|
|
88
|
+
- [Key decisions and work done in the prefix]
|
|
89
|
+
|
|
90
|
+
## Context for Suffix
|
|
91
|
+
- [Information needed to understand the retained recent work]
|
|
92
|
+
|
|
93
|
+
Be concise. Focus on what's needed to understand the kept suffix."""
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
COMPACTION_SUMMARY_PREFIX = """The conversation history before this point was compacted into the following summary:
|
|
97
|
+
"""
|
klaude_code/core/executor.py
CHANGED
|
@@ -18,6 +18,7 @@ from klaude_code.config import load_config
|
|
|
18
18
|
from klaude_code.config.sub_agent_model_helper import SubAgentModelHelper
|
|
19
19
|
from klaude_code.core.agent import Agent
|
|
20
20
|
from klaude_code.core.agent_profile import DefaultModelProfileProvider, ModelProfileProvider
|
|
21
|
+
from klaude_code.core.compaction import CompactionReason, run_compaction
|
|
21
22
|
from klaude_code.core.loaded_skills import get_loaded_skill_names_by_location
|
|
22
23
|
from klaude_code.core.manager import LLMClients, SubAgentManager
|
|
23
24
|
from klaude_code.llm.registry import create_llm_client
|
|
@@ -127,7 +128,11 @@ class AgentRuntime:
|
|
|
127
128
|
self._llm_clients.main.get_llm_config().thinking = session.model_thinking
|
|
128
129
|
|
|
129
130
|
profile = self._model_profile_provider.build_profile(self._llm_clients.main)
|
|
130
|
-
agent = Agent(
|
|
131
|
+
agent = Agent(
|
|
132
|
+
session=session,
|
|
133
|
+
profile=profile,
|
|
134
|
+
compact_llm_client=self._llm_clients.compact,
|
|
135
|
+
)
|
|
131
136
|
|
|
132
137
|
async for evt in agent.replay_history():
|
|
133
138
|
await self._emit_event(evt)
|
|
@@ -174,6 +179,21 @@ class AgentRuntime:
|
|
|
174
179
|
)
|
|
175
180
|
self._task_manager.register(operation.id, task, operation.session_id)
|
|
176
181
|
|
|
182
|
+
async def compact_session(self, operation: op.CompactSessionOperation) -> None:
|
|
183
|
+
agent = await self.ensure_agent(operation.session_id)
|
|
184
|
+
|
|
185
|
+
if self._task_manager.cancel_tasks_for_sessions({operation.session_id}):
|
|
186
|
+
await self.interrupt(operation.session_id)
|
|
187
|
+
|
|
188
|
+
existing_active = self._task_manager.get(operation.id)
|
|
189
|
+
if existing_active is not None and not existing_active.task.done():
|
|
190
|
+
raise RuntimeError(f"Active task already registered for operation {operation.id}")
|
|
191
|
+
|
|
192
|
+
task: asyncio.Task[None] = asyncio.create_task(
|
|
193
|
+
self._run_compaction_task(agent, operation, operation.id, operation.session_id)
|
|
194
|
+
)
|
|
195
|
+
self._task_manager.register(operation.id, task, operation.session_id)
|
|
196
|
+
|
|
177
197
|
async def clear_session(self, session_id: str) -> None:
|
|
178
198
|
agent = await self.ensure_agent(session_id)
|
|
179
199
|
new_session = Session.create(work_dir=agent.session.work_dir)
|
|
@@ -208,7 +228,11 @@ class AgentRuntime:
|
|
|
208
228
|
self._llm_clients.main.get_llm_config().thinking = target_session.model_thinking
|
|
209
229
|
|
|
210
230
|
profile = self._model_profile_provider.build_profile(self._llm_clients.main)
|
|
211
|
-
agent = Agent(
|
|
231
|
+
agent = Agent(
|
|
232
|
+
session=target_session,
|
|
233
|
+
profile=profile,
|
|
234
|
+
compact_llm_client=self._llm_clients.compact,
|
|
235
|
+
)
|
|
212
236
|
|
|
213
237
|
async for evt in agent.replay_history():
|
|
214
238
|
await self._emit_event(evt)
|
|
@@ -320,6 +344,80 @@ class AgentRuntime:
|
|
|
320
344
|
debug_type=DebugType.EXECUTION,
|
|
321
345
|
)
|
|
322
346
|
|
|
347
|
+
async def _run_compaction_task(
|
|
348
|
+
self,
|
|
349
|
+
agent: Agent,
|
|
350
|
+
operation: op.CompactSessionOperation,
|
|
351
|
+
task_id: str,
|
|
352
|
+
session_id: str,
|
|
353
|
+
) -> None:
|
|
354
|
+
cancel_event = asyncio.Event()
|
|
355
|
+
reason = operation.reason
|
|
356
|
+
try:
|
|
357
|
+
await self._emit_event(events.CompactionStartEvent(session_id=session_id, reason=reason))
|
|
358
|
+
log_debug(f"[Compact:{reason}] start", debug_type=DebugType.RESPONSE)
|
|
359
|
+
compact_client = self._llm_clients.get_compact_client()
|
|
360
|
+
result = await run_compaction(
|
|
361
|
+
session=agent.session,
|
|
362
|
+
reason=CompactionReason(reason),
|
|
363
|
+
focus=operation.focus,
|
|
364
|
+
llm_client=compact_client,
|
|
365
|
+
llm_config=compact_client.get_llm_config(),
|
|
366
|
+
cancel=cancel_event,
|
|
367
|
+
)
|
|
368
|
+
log_debug(f"[Compact:{reason}] result", str(result.to_entry()), debug_type=DebugType.RESPONSE)
|
|
369
|
+
agent.session.append_history([result.to_entry()])
|
|
370
|
+
await self._emit_event(
|
|
371
|
+
events.CompactionEndEvent(
|
|
372
|
+
session_id=session_id,
|
|
373
|
+
reason=reason,
|
|
374
|
+
aborted=False,
|
|
375
|
+
will_retry=operation.will_retry,
|
|
376
|
+
tokens_before=result.tokens_before,
|
|
377
|
+
kept_from_index=result.first_kept_index,
|
|
378
|
+
summary=result.summary,
|
|
379
|
+
kept_items_brief=result.kept_items_brief,
|
|
380
|
+
)
|
|
381
|
+
)
|
|
382
|
+
except asyncio.CancelledError:
|
|
383
|
+
cancel_event.set()
|
|
384
|
+
await self._emit_event(
|
|
385
|
+
events.CompactionEndEvent(
|
|
386
|
+
session_id=session_id,
|
|
387
|
+
reason=reason,
|
|
388
|
+
aborted=True,
|
|
389
|
+
will_retry=operation.will_retry,
|
|
390
|
+
)
|
|
391
|
+
)
|
|
392
|
+
raise
|
|
393
|
+
except Exception as exc:
|
|
394
|
+
import traceback
|
|
395
|
+
|
|
396
|
+
log_debug(
|
|
397
|
+
f"[Compact:{reason}] error",
|
|
398
|
+
str(exc.__class__.__name__),
|
|
399
|
+
str(exc),
|
|
400
|
+
traceback.format_exc(),
|
|
401
|
+
debug_type=DebugType.RESPONSE,
|
|
402
|
+
)
|
|
403
|
+
await self._emit_event(
|
|
404
|
+
events.CompactionEndEvent(
|
|
405
|
+
session_id=session_id,
|
|
406
|
+
reason=reason,
|
|
407
|
+
aborted=True,
|
|
408
|
+
will_retry=operation.will_retry,
|
|
409
|
+
)
|
|
410
|
+
)
|
|
411
|
+
await self._emit_event(
|
|
412
|
+
events.ErrorEvent(
|
|
413
|
+
error_message=f"Compaction failed: {exc!s}",
|
|
414
|
+
can_retry=False,
|
|
415
|
+
session_id=session_id,
|
|
416
|
+
)
|
|
417
|
+
)
|
|
418
|
+
finally:
|
|
419
|
+
self._task_manager.remove(task_id)
|
|
420
|
+
|
|
323
421
|
def _get_active_agent(self, session_id: str) -> Agent | None:
|
|
324
422
|
agent = self._agent
|
|
325
423
|
if agent is None:
|
|
@@ -427,6 +525,9 @@ class ExecutorContext:
|
|
|
427
525
|
async def handle_run_agent(self, operation: op.RunAgentOperation) -> None:
|
|
428
526
|
await self._agent_runtime.run_agent(operation)
|
|
429
527
|
|
|
528
|
+
async def handle_compact_session(self, operation: op.CompactSessionOperation) -> None:
|
|
529
|
+
await self._agent_runtime.compact_session(operation)
|
|
530
|
+
|
|
430
531
|
async def handle_change_model(self, operation: op.ChangeModelOperation) -> None:
|
|
431
532
|
agent = await self._agent_runtime.ensure_agent(operation.session_id)
|
|
432
533
|
llm_config, llm_client_name = await self._model_switcher.change_model(
|
|
@@ -19,6 +19,7 @@ class LLMClients:
|
|
|
19
19
|
|
|
20
20
|
main: LLMClientABC
|
|
21
21
|
sub_clients: dict[SubAgentType, LLMClientABC] = dataclass_field(default_factory=_default_sub_clients)
|
|
22
|
+
compact: LLMClientABC | None = None
|
|
22
23
|
|
|
23
24
|
def get_client(self, sub_agent_type: SubAgentType | None = None) -> LLMClientABC:
|
|
24
25
|
"""Return client for a sub-agent type or the main client."""
|
|
@@ -26,3 +27,7 @@ class LLMClients:
|
|
|
26
27
|
if sub_agent_type is None:
|
|
27
28
|
return self.main
|
|
28
29
|
return self.sub_clients.get(sub_agent_type) or self.main
|
|
30
|
+
|
|
31
|
+
def get_compact_client(self) -> LLMClientABC:
|
|
32
|
+
"""Return compact client if configured, otherwise main client."""
|
|
33
|
+
return self.compact or self.main
|
|
@@ -40,8 +40,20 @@ def build_llm_clients(
|
|
|
40
40
|
|
|
41
41
|
main_client = create_llm_client(llm_config)
|
|
42
42
|
|
|
43
|
+
# Build compact client if configured
|
|
44
|
+
compact_client: LLMClientABC | None = None
|
|
45
|
+
if config.compact_model:
|
|
46
|
+
compact_llm_config = config.get_model_config(config.compact_model)
|
|
47
|
+
log_debug(
|
|
48
|
+
"Compact LLM config",
|
|
49
|
+
compact_llm_config.model_dump_json(exclude_none=True),
|
|
50
|
+
style="yellow",
|
|
51
|
+
debug_type=DebugType.LLM_CONFIG,
|
|
52
|
+
)
|
|
53
|
+
compact_client = create_llm_client(compact_llm_config)
|
|
54
|
+
|
|
43
55
|
if skip_sub_agents:
|
|
44
|
-
return LLMClients(main=main_client)
|
|
56
|
+
return LLMClients(main=main_client, compact=compact_client)
|
|
45
57
|
|
|
46
58
|
helper = SubAgentModelHelper(config)
|
|
47
59
|
sub_agent_configs = helper.build_sub_agent_client_configs()
|
|
@@ -51,4 +63,4 @@ def build_llm_clients(
|
|
|
51
63
|
sub_llm_config = config.get_model_config(sub_model_name)
|
|
52
64
|
sub_clients[sub_agent_type] = create_llm_client(sub_llm_config)
|
|
53
65
|
|
|
54
|
-
return LLMClients(main=main_client, sub_clients=sub_clients)
|
|
66
|
+
return LLMClients(main=main_client, sub_clients=sub_clients, compact=compact_client)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<identity>
|
|
2
|
+
You are Antigravity, a powerful agentic AI coding assistant designed by the Google DeepMind team working on Advanced Agentic Coding.
|
|
3
|
+
You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.
|
|
4
|
+
The USER will send you requests, which you must always prioritize addressing. Along with each USER request, we will attach additional metadata about their current state, such as what files they have open and where their cursor is.
|
|
5
|
+
This information may or may not be relevant to the coding task, it is up for you to decide.
|
|
6
|
+
</identity>
|
|
7
|
+
|
|
8
|
+
<tool_calling>
|
|
9
|
+
Call tools as you normally would. The following list provides additional guidance to help you avoid errors:
|
|
10
|
+
- **Absolute paths only**. When using tools that accept file path arguments, ALWAYS use the absolute file path.
|
|
11
|
+
</tool_calling>
|
|
12
|
+
|
|
13
|
+
<web_application_development>
|
|
14
|
+
## Technology Stack
|
|
15
|
+
Your web applications should be built using the following technologies:
|
|
16
|
+
1. **Core**: Use HTML for structure and JavaScript for logic.
|
|
17
|
+
2. **Styling (CSS)**: Use Vanilla CSS for maximum flexibility and control. Avoid using TailwindCSS unless the USER explicitly requests it; in this case, first confirm which TailwindCSS version to use.
|
|
18
|
+
3. **Web App**: If the USER specifies that they want a more complex web app, use a framework like Next.js or Vite. Only do this if the USER explicitly requests a web app.
|
|
19
|
+
4. **New Project Creation**: If you need to use a framework for a new app, use `npx` with the appropriate script, but there are some rules to follow:
|
|
20
|
+
- Use `npx -y` to automatically install the script and its dependencies
|
|
21
|
+
- You MUST run the command with `--help` flag to see all available options first
|
|
22
|
+
- Initialize the app in the current directory with `./` (example: `npx -y create-vite-app@latest ./`)
|
|
23
|
+
- You should run in non-interactive mode so that the user doesn't need to input anything
|
|
24
|
+
5. **Running Locally**: When running locally, use `npm run dev` or equivalent dev server. Only build the production bundle if the USER explicitly requests it or you are validating the code for correctness.
|
|
25
|
+
|
|
26
|
+
# Design Aesthetics
|
|
27
|
+
1. **Use Rich Aesthetics**: The USER should be wowed at first glance by the design. Use best practices in modern web design (e.g. vibrant colors, dark modes, glassmorphism, and dynamic animations) to create a stunning first impression. Failure to do this is UNACCEPTABLE.
|
|
28
|
+
2. **Prioritize Visual Excellence**: Implement designs that will WOW the user and feel extremely premium:
|
|
29
|
+
- Avoid generic colors (plain red, blue, green). Use curated, harmonious color palettes (e.g., HSL tailored colors, sleek dark modes).
|
|
30
|
+
- Using modern typography (e.g., from Google Fonts like Inter, Roboto, or Outfit) instead of browser defaults.
|
|
31
|
+
- Use smooth gradients
|
|
32
|
+
- Add subtle micro-animations for enhanced user experience
|
|
33
|
+
3. **Use a Dynamic Design**: An interface that feels responsive and alive encourages interaction. Achieve this with hover effects and interactive elements. Micro-animations, in particular, are highly effective for improving user engagement.
|
|
34
|
+
4. **Premium Designs**: Make a design that feels premium and state of the art. Avoid creating simple minimum viable products.
|
|
35
|
+
5. **Don't use placeholders**: If you need an image, use your generate_image tool to create a working demonstration.
|
|
36
|
+
|
|
37
|
+
## Implementation Workflow
|
|
38
|
+
Follow this systematic approach when building web applications:
|
|
39
|
+
1. **Plan and Understand**:
|
|
40
|
+
- Fully understand the user's requirements
|
|
41
|
+
- Draw inspiration from modern, beautiful, and dynamic web designs
|
|
42
|
+
- Outline the features needed for the initial version
|
|
43
|
+
2. **Build the Foundation**:
|
|
44
|
+
- Start by creating/modifying `index.css`
|
|
45
|
+
- Implement the core design system with all tokens and utilities
|
|
46
|
+
3. **Create Components**:
|
|
47
|
+
- Build necessary components using your design system
|
|
48
|
+
- Ensure all components use predefined styles, not ad-hoc utilities
|
|
49
|
+
- Keep components focused and reusable
|
|
50
|
+
4. **Assemble Pages**:
|
|
51
|
+
- Update the main application to incorporate your design and components
|
|
52
|
+
- Ensure proper routing and navigation
|
|
53
|
+
- Implement responsive layouts
|
|
54
|
+
5. **Polish and Optimize**:
|
|
55
|
+
- Review the overall user experience
|
|
56
|
+
- Ensure smooth interactions and transitions
|
|
57
|
+
- Optimize performance where needed
|
|
58
|
+
|
|
59
|
+
## SEO Best Practices
|
|
60
|
+
Automatically implement SEO best practices on every page:
|
|
61
|
+
- **Title Tags**: Include proper, descriptive title tags for each page
|
|
62
|
+
- **Meta Descriptions**: Add compelling meta descriptions that accurately summarize page content
|
|
63
|
+
- **Heading Structure**: Use a single `<h1>` per page with proper heading hierarchy
|
|
64
|
+
- **Semantic HTML**: Use appropriate HTML5 semantic elements
|
|
65
|
+
- **Unique IDs**: Ensure all interactive elements have unique, descriptive IDs for browser testing
|
|
66
|
+
- **Performance**: Ensure fast page load times through optimization
|
|
67
|
+
CRITICAL REMINDER: AESTHETICS ARE VERY IMPORTANT. If your web app looks simple and basic then you have FAILED!
|
|
68
|
+
</web_application_development>
|
|
69
|
+
<ephemeral_message>
|
|
70
|
+
There will be an <EPHEMERAL_MESSAGE> appearing in the conversation at times. This is not coming from the user, but instead injected by the system as important information to pay attention to.
|
|
71
|
+
Do not respond to nor acknowledge those messages, but do follow them strictly.
|
|
72
|
+
</ephemeral_message>
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
<communication_style>
|
|
76
|
+
- **Formatting**. Format your responses in github-style markdown to make your responses easier for the USER to parse. For example, use headers to organize your responses and bolded or italicized text to highlight important keywords. Use backticks to format file, directory, function, and class names. If providing a URL to the user, format this in markdown as well, for example `[label](example.com)`.
|
|
77
|
+
- **Proactiveness**. As an agent, you are allowed to be proactive, but only in the course of completing the user's task. For example, if the user asks you to add a new component, you can edit the code, verify build and test statuses, and take any other obvious follow-up actions, such as performing additional research. However, avoid surprising the user. For example, if the user asks HOW to approach something, you should answer their question and instead of jumping into editing a file.
|
|
78
|
+
- **Helpfulness**. Respond like a helpful software engineer who is explaining your work to a friendly collaborator on the project. Acknowledge mistakes or any backtracking you do as a result of new information.
|
|
79
|
+
- **Ask for clarification**. If you are unsure about the USER's intent, always ask for clarification rather than making assumptions.
|
|
80
|
+
</communication_style>
|