Skip to content

Commit 819f68c

Browse files
authored
chore(tasks): add shell efficiency instruction to agent prompts (#68805)
1 parent 6790440 commit 819f68c

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

products/tasks/backend/prompts.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
WIZARD_PR_AGENT_PROMPT = """
1+
SHELL_EFFICIENCY_INSTRUCTION = """\
2+
Shell efficiency: optimize for the fewest shell round trips.
3+
- Batch related commands into one Bash invocation using `&&` (e.g. `npm run typecheck && npm run lint && npm test`).
4+
- Emit all independent tool calls in the same response.
5+
- Read multiple files at once.
6+
- Never rerun a command solely to reproduce output you already have."""
7+
8+
WIZARD_PR_AGENT_PROMPT = f"""
29
PostHog's setup wizard has already run in this repository and integrated PostHog. The working tree
310
contains its uncommitted changes (modified source files, an updated package manifest, installed
411
dependencies, a `posthog-setup-report.md` summary, and possibly a `.posthog-events.json` plan).
@@ -45,6 +52,8 @@
4552
full URL (e.g. a Markdown link like [#123](https://github.com/org/repo/pull/123)) rather than plain
4653
text, so readers can open it directly.
4754
55+
{SHELL_EFFICIENCY_INSTRUCTION}
56+
4857
Hard limits: stay strictly within the wizard's changes, plus the changes required to automatically
4958
configure the environment variables in production, plus the minimal fixes needed for CI to pass.
5059
When keeping CI green, do not modify unrelated code, add/remove/upgrade dependencies beyond

products/tasks/backend/temporal/constants.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
from django.conf import settings
1313

14+
from products.tasks.backend.prompts import SHELL_EFFICIENCY_INSTRUCTION
15+
1416
# Per-task inactivity timeout defaults (production). User-driven runs — explicitly
1517
# user-created, or with no origin product — get a longer idle grace window since a
1618
# human may still be in the loop; automated/background runs reclaim the sandbox
@@ -96,7 +98,7 @@ def resolve_inactivity_timeout(*, is_user_origin: bool = False, state: dict | No
9698
# flush rate-limits retries.
9799
OUTBOUND_RETRY_BACKOFF = timedelta(seconds=10)
98100

99-
DEFAULT_CI_MESSAGE = """\
101+
DEFAULT_CI_MESSAGE = f"""\
100102
You are re-entering this run to address CI feedback on the pull request you opened.
101103
102104
Scope (what to do):
@@ -122,4 +124,6 @@ def resolve_inactivity_timeout(*, is_user_origin: bool = False, state: dict | No
122124
When you mention the pull request in your summary, always hyperlink it to its full URL (e.g. a
123125
Markdown link like [#123](https://github.com/org/repo/pull/123)) rather than plain text, so readers
124126
can open it directly.
127+
128+
{SHELL_EFFICIENCY_INSTRUCTION}
125129
""".strip()

0 commit comments

Comments
 (0)