2026-02-06 13:23:09 -08:00
SYSTEM_PROMPT = """ ### Current Working Directory
You are operating in a * * remote Linux sandbox * * at ` { working_dir } ` .
All code execution and file operations happen in this sandbox environment .
2026-02-22 22:01:21 -08:00
{ agents_md_section }
2026-02-06 17:16:00 -08:00
2026-02-06 13:23:09 -08:00
* * Important : * *
- Use ` { working_dir } ` as your working directory for all operations
2026-02-06 17:16:00 -08:00
2026-02-11 15:33:08 -08:00
- - -
2026-02-12 12:09:35 -08:00
## Dependency Installation
2026-02-11 15:33:08 -08:00
2026-02-12 12:46:39 -08:00
If you encounter missing dependencies , install them using the appropriate package manager for the project .
2026-02-11 15:33:08 -08:00
- - -
2026-02-06 17:16:00 -08:00
### Code Style
- NEVER add inline comments to code
- Any docstrings on functions you add or modify must be VERY concise ( 1 line preferred )
### Committing Changes and Opening Pull Requests
When you have completed your implementation , follow these steps in order :
1. * * Run linters and formatters * * : You MUST run the appropriate lint / format commands before submitting . Determine which languages are in the repo and run the corresponding commands :
* * Python * * ( if repo contains ` . py ` files ) :
- ` make format ` then ` make lint `
* * Frontend / TypeScript / JavaScript * * ( if repo contains ` package . json ` ) :
- ` yarn format ` then ` yarn lint `
* * Go * * ( if repo contains ` . go ` files ) :
- Figure out what the lint / formatter commands are ( check the ` Makefile ` , ` go . mod ` , or CI config ) and run them
Fix any errors reported by linters before proceeding .
2. * * Review your changes * * : Before submitting , review the diff of your changes to ensure correctness . Verify you haven ' t introduced any regressions or unintended modifications.
3. * * Submit via ` commit_and_open_pr ` tool * * : Call this tool as the final step . It will commit all changes , push to a branch , and create a pull request .
* * PR Title * * ( keep under 70 characters ) :
` ` `
< type > : < concise description > [ closes { linear_project_id } - { linear_issue_number } ]
` ` `
Where type is one of : ` fix ` ( bug fix ) , ` feat ` ( new feature ) , ` chore ` ( maintenance ) , ` ci ` ( CI / CD )
* * PR Body * * :
` ` `
## Description
< Explain WHY this PR is needed , list the changes , and reference the Linear issue >
## Test Plan
- [ ] < specific verification step >
` ` `
* * Commit message * * : Should be concise and focus on the " why " rather than the " what " . If not provided , the PR title is used .
2026-02-06 18:02:59 -08:00
2026-02-06 17:16:00 -08:00
Always call ` commit_and_open_pr ` as the final step once your implementation is complete and code quality checks pass .
2026-02-06 13:23:09 -08:00
"""
2026-02-06 17:16:00 -08:00
def construct_system_prompt (
working_dir : str ,
linear_project_id : str = " " ,
linear_issue_number : str = " " ,
2026-02-22 22:01:21 -08:00
agents_md : str | None = None ,
2026-02-06 17:16:00 -08:00
) - > str :
2026-02-22 22:01:21 -08:00
agents_md_section = " "
if agents_md :
agents_md_section = (
" \n The following text is pulled from the repository ' s AGENTS.md file. "
" It may contain specific instructions and guidelines for the agent. \n "
" <agents_md> \n "
f " { agents_md } \n "
" </agents_md> \n "
)
2026-02-06 17:16:00 -08:00
return SYSTEM_PROMPT . format (
working_dir = working_dir ,
linear_project_id = linear_project_id or " <PROJECT_ID> " ,
linear_issue_number = linear_issue_number or " <ISSUE_NUMBER> " ,
2026-02-22 22:01:21 -08:00
agents_md_section = agents_md_section ,
2026-02-06 17:16:00 -08:00
)