Skip to content

Commit 4f3948f

Browse files
author
Kim Harjamaki
committed
Add memory guidelines and fix recording script
1 parent e35ff4d commit 4f3948f

3 files changed

Lines changed: 113 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Codex Agent Guidelines
2+
3+
## Memory of successful fixes
4+
- After each successful fix, write a memory entry in `memory/examples/`.
5+
- Each entry must include: Issue Description, State, Action, Result, Diff Patch, and Rationale.
6+
- Keep entries short, factual, and scoped to the repo.
7+
- If a fix is later invalid, annotate the entry with an "Outdated" note instead of deleting it.
8+
9+
## Verification and retries
10+
- Always verify changes by running the relevant workflow/test when possible.
11+
- If verification fails, adjust strategy and retry with a clean state; avoid compounding changes.
12+
- Stop after 2-3 failed attempts and surface a clear summary for human review.
13+
14+
## Safety and scope
15+
- Make minimal, targeted changes. Avoid unrelated refactors.
16+
- Use least-privilege tokens; prefer `GITHUB_TOKEN`, fall back to PAT secrets only when required.
17+
- Do not assume files or APIs exist; confirm before using them.
18+
19+
## Cross-repo reuse
20+
- Reuse patterns from `memory/examples/` when a new issue matches prior symptoms.
21+
- Keep project-specific details inside project memory entries only.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Autopilot docs workflow token and defaults
2+
3+
Issue Description:
4+
Docs workflow failed due to missing org context and API access for issue search.
5+
6+
State:
7+
Workflow reported a configuration error and never ran jobs.
8+
9+
Action:
10+
Added issues read permission, defaulted ORG to repository owner, and allowed an ORG_READ_TOKEN override.
11+
12+
Result:
13+
Workflow can run with default org and proper permissions.
14+
15+
Rationale:
16+
Defaults reduce configuration drift and ensure GitHub API queries succeed.
17+
18+
Diff Patch:
19+
```diff
20+
commit 1685a44293505df0fa2d5f7a7aa968a3d81a7261
21+
Author: Kim Harjamaki <ogeon@msn.com>
22+
Date: Mon Dec 22 23:20:48 2025 +0200
23+
24+
Harden docs workflow token and defaults
25+
26+
diff --git a/.github/workflows/autopilot-docs-daily.yml b/.github/workflows/autopilot-docs-daily.yml
27+
index 412350c..b26ed43 100644
28+
--- a/.github/workflows/autopilot-docs-daily.yml
29+
+++ b/.github/workflows/autopilot-docs-daily.yml
30+
@@ -9,13 +9,14 @@ on:
31+
permissions:
32+
contents: write
33+
pull-requests: write
34+
+ issues: read
35+
36+
jobs:
37+
docs:
38+
runs-on: ubuntu-latest
39+
env:
40+
- ORG: ${{ vars.ORG }}
41+
- GH_TOKEN: ${{ github.token }}
42+
+ ORG: ${{ vars.ORG || github.repository_owner }}
43+
+ GH_TOKEN: ${{ secrets.ORG_READ_TOKEN || github.token }}
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
```

scripts/record-fix.ps1

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
param(
2+
[Parameter(Mandatory=$true)][string]$Issue,
3+
[Parameter(Mandatory=$true)][string]$State,
4+
[Parameter(Mandatory=$true)][string]$Action,
5+
[Parameter(Mandatory=$true)][string]$Result,
6+
[Parameter(Mandatory=$true)][string]$Rationale,
7+
[string]$Title = "Fix summary",
8+
[string]$Commit = "HEAD"
9+
)
10+
11+
$ErrorActionPreference = "Stop"
12+
$repoRoot = Resolve-Path (Split-Path -Parent $MyInvocation.MyCommand.Path) | Split-Path -Parent
13+
$memoryDir = Join-Path $repoRoot "memory\examples"
14+
if (-not (Test-Path $memoryDir)) { New-Item -ItemType Directory -Path $memoryDir | Out-Null }
15+
16+
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
17+
$diff = git -C $repoRoot show --no-color $Commit
18+
$path = Join-Path $memoryDir ("{0}_fix.md" -f $timestamp)
19+
20+
$content = @"
21+
# $Title
22+
23+
Issue Description:
24+
$Issue
25+
26+
State:
27+
$State
28+
29+
Action:
30+
$Action
31+
32+
Result:
33+
$Result
34+
35+
Rationale:
36+
$Rationale
37+
38+
Diff Patch:
39+
```diff
40+
$diff
41+
```
42+
"@
43+
44+
$content | Set-Content -Path $path -Encoding UTF8
45+
Write-Host "Wrote memory entry: $path"

0 commit comments

Comments
 (0)