Skip to content

Add Dreaming workflow to curate Copilot memory weekly - #14357

Merged
jankratochvilcz merged 2 commits into
mainfrom
jankratochvilcz-dreaming-workflow
Jul 15, 2026
Merged

jankratochvilcz merged 2 commits into
mainfrom
jankratochvilcz-dreaming-workflow

Conversation

@jankratochvilcz

Copy link
Copy Markdown
Contributor

What

Adds a new agentic workflow, Dreaming (Copilot memory curation), inspired by Claude Managed Agents' "dreaming" — a scheduled between-sessions process that reviews recent activity, extracts recurring patterns a single session can't see, and curates the shared memory so future agents and contributors improve over time.

  • .github/workflows/dreaming.agent.md — source workflow
  • .github/workflows/dreaming.agent.lock.yml — compiled output (gh aw compile, v0.79.8, actionlint clean)

What it does

Weekly (Monday) and via manual workflow_dispatch, the agent:

  1. Reviews the past 7 days of pull requests, review threads, inline comments, and conversations (skipping bot dependency PRs).
  2. Reads CI check outcomes (gh pr checks / checks + statuses API) to categorize recurring sources of misses — the common mistakes reviewers keep pointing out and the common CI failure categories.
  3. Curates the Copilot "memory" store — AGENTS.md (the .github/copilot-instructions.md symlink target), .github/instructions/**, .github/skills/**, .github/agents/** — and opens one ready-for-review [Dreaming] PR with small, high-signal changes. Emits a silent noop on a quiet week.

Guardrails (per the two explicit constraints)

  • No duplicate information — a pattern must recur across 2+ PRs/comments (or repeated CI failures); the agent greps existing memory first and deduplicates against its own edits.
  • Only small bits; prefer changing over adding — every change is a few lines, existing guidance is amended in place before anything new is added, capped at ~5 changes/run, and creating new files is a last resort.
  • PR edits are locked to the four memory paths via allowed-files, with .github/workflows/** excluded. A maintainer always reviews/merges; the workflow never self-merges.

Consistency with existing agentic workflows

Reuses the shared pat_pool import, the copilot-pat-pool environment, and the same COPILOT_PAT_* token rotation + copilot engine as review / close-stale-prs / flaky-*. Compiled action pins match every other committed .lock.yml (checkout v7.0.0, gh-aw-actions/setup v0.82.8). No unrelated file churn.

Security review note

  • Secrets: only the existing shared COPILOT_PAT_0..9 pool secrets (identical to the other agentic workflows). No new secrets introduced.
  • Actions: all pinned to the same SHAs already used across the repo's committed lock files. No new or unpinned actions.
  • Permissions: read-only (contents, pull-requests, issues, checks, statuses, actions). The only write path is the gated create-pull-request safe output, restricted to the memory files.
  • Network: GitHub defaults only (no external/AzDO egress).

Notes

Real CI here is Azure DevOps; the workflow intentionally categorizes GitHub-surfaced check conclusions rather than deep-mining AzDO logs (that's the flaky-test workflows' job), which keeps it on the default GitHub network with no extra firewall configuration.

Inspired by Claude Managed Agents 'dreaming': a scheduled agent that reviews
the past week of PRs, review feedback, conversations, and CI check outcomes to
find recurring misses, then curates the repo's Copilot memory (AGENTS.md,
.github/instructions/**, .github/skills/**, .github/agents/**) with small,
non-duplicate changes — preferring edits over additions — and opens one PR.

Runs weekly on Monday and via workflow_dispatch. Uses the shared PAT pool and
copilot engine like the other agentic workflows. PR edits are restricted to the
memory files via allowed-files.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1b63f3d4-d050-4905-9e00-bee816df8a94
@jankratochvilcz
jankratochvilcz marked this pull request as ready for review July 14, 2026 18:31
@jankratochvilcz
jankratochvilcz requested a review from a team as a code owner July 14, 2026 18:31
Copilot AI review requested due to automatic review settings July 14, 2026 18:31
@jankratochvilcz

Copy link
Copy Markdown
Contributor Author

(need to merge this to trigger-this from follow-up PRs to understand utility)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new scheduled agentic workflow (“Dreaming”) intended to periodically review recent repo activity and curate Copilot’s durable instruction/memory files by opening a single small PR (or emitting a noop).

Changes:

  • Introduces .github/workflows/dreaming.agent.md defining the Dreaming agent workflow (weekly + manual trigger) with guarded safe-outputs restricted to memory files.
  • Adds the compiled workflow output .github/workflows/dreaming.agent.lock.yml generated by gh aw compile to pin actions/containers and enforce safe-output constraints.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/dreaming.agent.md Defines the new Dreaming agent workflow, its prompt/guardrails, permissions, and safe-output allowlist for memory curation PRs.
.github/workflows/dreaming.agent.lock.yml Compiled/pinned workflow generated from the .agent.md source, including safe-output enforcement and runtime wiring.

Comment thread .github/workflows/dreaming.agent.md Resolved

@rainersigwald rainersigwald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth a shot

Comment thread .github/workflows/dreaming.agent.md Resolved
- Replace the 'Copilot memory' terminology with 'learning atoms' throughout to
  avoid conflation with GitHub Copilot's separate 'memory' feature
  (per review feedback), keeping one explicit note distinguishing the two.
- Use the existing 'Area: Documentation' label instead of the non-existent
  'documentation' label, which would have failed PR creation with a 404.
- Recompile the lock file to pick up both changes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1b63f3d4-d050-4905-9e00-bee816df8a94
@jankratochvilcz
jankratochvilcz merged commit 11b8528 into main Jul 15, 2026
14 checks passed
@jankratochvilcz
jankratochvilcz deleted the jankratochvilcz-dreaming-workflow branch July 15, 2026 08:09
jankratochvilcz added a commit that referenced this pull request Jul 15, 2026
… curation PR (#14369)

## Problem

The Dreaming workflow (added in #14357) ran end-to-end successfully for
the first time after the fleet gh-aw upgrade (#14365), produced a
high-quality proposal (two small "learning atom" edits to
`.github/instructions/*.instructions.md`) — but **never opened a PR**.
It fell back to opening a review *issue* (#14368) instead.

### Root cause

The workflow's whole job is to curate the "learning atoms": `AGENTS.md`
and everything under `.github/instructions`, `.github/skills`,
`.github/agents`. Those are *exactly* the paths gh-aw's default
file-protection policy guards:

- `AGENTS.md` is in the built-in `protected_files` list, and
- `protect_top_level_dot_folders: true` (a v0.82.9 default) marks every
`.github/**` path as protected.

The default `protected-files` policy is `request_review`. When a run
edited the protected instruction files, the safe-outputs **signed-commit
push was refused**:

```
pushSignedCommits: refusing unsigned push for branch 'dreaming/…':
Signed-commit payload violates file-protection policy (request_review):
.github/instructions/tasks.instructions.md, .github/instructions/tests.instructions.md
```

…so the run silently degraded to a review issue.

## Fix

Set `protected-files: allowed` on the `create-pull-request` safe output.

Verified against the pinned setup action (`github/gh-aw-actions/setup`
v0.82.9, `ca8678ca`): both `checkFileProtection` (pre-apply) and
`checkFileProtectionPostApply` (the exact function the signed-push gate
calls) short-circuit to `{ action: "allow" }` when the policy is
`allowed`, **before** the manifest/dot-folder checks run.

### Why this is safe

- The tight `allowed-files` allowlist (`AGENTS.md`,
`.github/instructions/**`, `.github/skills/**`, `.github/agents/**`) is
the real guardrail. It is enforced **independently and ahead of** the
protected-files check, so the agent still cannot touch product code,
tests, build manifests, or the workflow definitions.
- The PR still needs **maintainer approval** before it can merge, so
human review is preserved at the PR gate — the `request_review` issue
fallback was redundant friction for a workflow whose only output is a PR
against these files.

## Diff

Two files, minimal:

- `.github/workflows/dreaming.agent.md` — one `protected-files: allowed`
line (+ explanatory comment) in the `create-pull-request` config.
- `.github/workflows/dreaming.agent.lock.yml` — regenerated via `gh aw
compile dreaming.agent --approve`; the only functional change is
`protected_files_policy: request_review` → `allowed` (plus the
auto-generated frontmatter/EOF hashes).

Once merged, a re-run should open the curation PR directly instead of
issue #14368.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants