-
Notifications
You must be signed in to change notification settings - Fork 418
Compact generated system prompt blocks by flattening XML wrappers and removing duplicated guidance #38049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compact generated system prompt blocks by flattening XML wrappers and removing duplicated guidance #38049
Changes from 2 commits
84b2c21
ccf28e4
80b3225
7c9dba4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| <cache-memory> | ||
| <path>__GH_AW_CACHE_DIR__</path>__GH_AW_CACHE_DESCRIPTION__ | ||
| <properties>Persistent read/write storage across workflow runs via Actions cache. Last write wins.</properties>__GH_AW_ALLOWED_EXTENSIONS__ | ||
| <cache-miss-guidance>If you look for data in the cache and do not find any, call the `missing_data` tool with `data_type: "cache_memory"` and `reason: "cache_memory_miss"` to signal that the cache does not contain the expected information.</cache-miss-guidance> | ||
| Path: __GH_AW_CACHE_DIR____GH_AW_CACHE_DESCRIPTION__ | ||
| Persistent read/write storage across workflow runs via Actions cache. Last write wins.__GH_AW_ALLOWED_EXTENSIONS__ | ||
| If you look for data in the cache and do not find any, call the `missing_data` tool with `data_type: "cache_memory"` and `reason: "cache_memory_miss"` to signal that the cache does not contain the expected information. | ||
| </cache-memory> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| <cache-memory> | ||
| __GH_AW_CACHE_LIST__ | ||
| <properties>Persistent read/write storage across workflow runs via Actions cache. Last write wins.</properties>__GH_AW_ALLOWED_EXTENSIONS__ | ||
| <examples> | ||
| Persistent read/write storage across workflow runs via Actions cache. Last write wins.__GH_AW_ALLOWED_EXTENSIONS__ | ||
| Examples: | ||
| __GH_AW_CACHE_EXAMPLES__ | ||
| </examples> | ||
| <cache-miss-guidance>If you look for data in the cache and do not find any, call the `missing_data` tool with `data_type: "cache_memory"` and `reason: "cache_memory_miss"` to signal that the cache does not contain the expected information.</cache-miss-guidance> | ||
| If you look for data in the cache and do not find any, call the `missing_data` tool with `data_type: "cache_memory"` and `reason: "cache_memory_miss"` to signal that the cache does not contain the expected information. | ||
| </cache-memory> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| <markdown-generation> | ||
| <rule>Only use 4-backtick fences when the block literally contains triple-backtick fences inside it; otherwise use standard 3-backtick fences. Use GitHub Flavored Markdown.</rule> | ||
| Only use 4-backtick fences when the block literally contains triple-backtick fences inside it; otherwise use standard 3-backtick fences. Use GitHub Flavored Markdown. | ||
| </markdown-generation> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,12 +2,6 @@ | |
| <path>/tmp/gh-aw/agent/</path> | ||
| <instruction>When you need to create temporary files or directories during your work, always use the /tmp/gh-aw/agent/ directory that has been pre-created for you. Do NOT use the root /tmp/ directory directly.</instruction> | ||
| </temporary-files> | ||
| <file-editing> | ||
| <allowed-paths> | ||
| Do NOT attempt to edit files outside these directories as you do not have the necessary permissions. | ||
| </file-editing> | ||
| <environment-limitations> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/zoom-out] The The malformed XML (missing |
||
| <docker> | ||
| Docker in Docker is not supported. | ||
| </docker> | ||
| </environment-limitations> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -798,11 +798,11 @@ func buildCacheMemoryPromptSection(config *CacheMemoryConfig) *PromptSection { | |
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot revert all .go changes
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted — |
||
|
|
||
| // Build allowed extensions text. | ||
| // When non-empty, wrap as an XML element so the agent knows about file-type restrictions. | ||
| // When non-empty, add a compact plain-text restriction line. | ||
| // When empty (all extensions allowed), the placeholder is replaced with nothing. | ||
| var allowedExtsText string | ||
| if len(cache.AllowedExtensions) > 0 { | ||
| allowedExtsText = "\n<allowed-extensions>" + strings.Join(cache.AllowedExtensions, ", ") + "</allowed-extensions>" | ||
| allowedExtsText = "\nAllowed file extensions: " + strings.Join(cache.AllowedExtensions, ", ") + "." | ||
| } | ||
|
|
||
| cacheLog.Printf("Building cache memory prompt section with env vars: cache_dir=%s, description=%s, allowed_extensions=%v", cacheDir, descriptionText, cache.AllowedExtensions) | ||
|
|
@@ -812,7 +812,7 @@ func buildCacheMemoryPromptSection(config *CacheMemoryConfig) *PromptSection { | |
| Content: cacheMemoryPromptFile, | ||
| IsFile: true, | ||
| EnvVars: map[string]string{ | ||
| "GH_AW_CACHE_DIR": cacheDir, | ||
| "GH_AW_CACHE_DIR": "`" + cacheDir + "`", | ||
| "GH_AW_CACHE_DESCRIPTION": descriptionText, | ||
| "GH_AW_ALLOWED_EXTENSIONS": allowedExtsText, | ||
| }, | ||
|
|
@@ -836,7 +836,7 @@ func buildCacheMemoryPromptSection(config *CacheMemoryConfig) *PromptSection { | |
|
|
||
| // Build allowed extensions text. | ||
| // Compute the union of all allowed extensions across all caches. | ||
| // When non-empty, wrap as an XML element so the agent knows about file-type restrictions. | ||
| // When non-empty, add a compact plain-text restriction line. | ||
| // When empty (all extensions allowed for all caches), the placeholder is replaced with nothing. | ||
| allSame := true | ||
| for i := 1; i < len(config.Caches); i++ { | ||
|
|
@@ -873,7 +873,7 @@ func buildCacheMemoryPromptSection(config *CacheMemoryConfig) *PromptSection { | |
|
|
||
| var allowedExtsText string | ||
| if len(extsUnion) > 0 { | ||
| allowedExtsText = "\n<allowed-extensions>" + strings.Join(extsUnion, ", ") + "</allowed-extensions>" | ||
| allowedExtsText = "\nAllowed file extensions: " + strings.Join(extsUnion, ", ") + "." | ||
| } | ||
|
|
||
| // Build cache examples | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot add quote around cache for, separate with space for description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done —
cache_memory_prompt.mdline 2 now readsPath: `__GH_AW_CACHE_DIR__` __GH_AW_CACHE_DESCRIPTION__. The leading-space prefix was moved from the GodescriptionTextvalue into the template separator so there's no double-space when a description is provided.