Repository navigation
Commit 7ddb584
feat(canvas): give agents the learnings a repository accepted (#11)
<!-- Use a conventional commit-style title, such as "fix(hub): retain
prototype history". -->
## Why
<!-- Explain the problem and why this change matters in a short,
plain-English paragraph. Link the issue when applicable. -->
Agents working in a repository should have the guidance its
administrators accepted in Hub, without someone repeating those
decisions in every session. This change gives agents that context
through an approved Hub connection, without sending the person's prompt
to Hub.
## What changes
<!-- Describe what becomes different for a first-time reader. Explain
necessary terms. Include accurate Mermaid diagrams when they clarify the
proposal, using before/after diagrams when helpful. Add screenshots for
meaningful UI changes. -->
<!-- Omit validation sections, checklists, and routine test/CI summaries
such as "CI is green" or "tests passed". Mention only known verification
gaps that affect the change, not disclaimers about drafting this
description. -->
When someone submits a prompt, the Replica plugin asks Hub for the
repository's accepted learnings and adds them as session context. Hub
checks the connection's consent and the person's cached repository read
permission. The learning store records the recall as a use by that
person.
```mermaid
sequenceDiagram
actor Person
participant CLI as Copilot CLI with the Replica plugin
participant Hub
participant Store as Repository's learning store
Person->>CLI: Submit a prompt
CLI->>Hub: Ask for accepted learnings, without the prompt
Hub->>Store: Recall learnings as that person
Store-->>Hub: Text, learning IDs, and content digests
Note over Store: Record use by the person
Hub-->>CLI: Return accepted learnings
CLI->>CLI: Check the format and add session context
```
The connection approval page now explains that Copilot can add accepted
learnings to prompts. Hub records consent only when someone approves the
current disclosure. Existing connections and older approval forms still
connect without learnings; those users must disconnect and connect again
to enable them.
The new `POST /api/canvas/learnings/recall` endpoint returns the
learning text, IDs, and content digests, which identify changes to the
wording. The plugin accepts only the bounded format produced by
`replica-learning`, including its safety guidance that learnings are
data, not commands. The first successful response replaces earlier
learning context, including after a restart or session resume. Later
unchanged responses add nothing; changed or empty responses replace
earlier guidance. Turning Learnings off explicitly clears it.
The hook uses an existing connection and saved Hub selection; submitting
a prompt never starts pairing or Hub discovery. Token renewal happens in
the background for a later prompt. Hub limits each connection to 30
recalls per minute and stops slow recalls early enough for the plugin's
three-second deadline. Errors, invalid responses, and timeouts add no
context and never fail the prompt; older responses cannot overwrite a
newer one.
Copilot CLI 1.0.96 requires `--experimental` or `/experimental on` for
extensions. Loading a repository's project copy in prompt mode (`copilot
-p`) also requires `GITHUB_COPILOT_PROMPT_MODE_EXTENSIONS=true`. Its ACP
server does not load these hooks, so ACP clients do not receive
learnings through this plugin.
The live integration check uses an isolated local-mode Hub and synthetic
data; GitHub-backed OAuth and cross-account authorization remain
unverified by that check. Its off/restore case exercises Hub's
`learnings_off` response, not disconnecting a real Copilot account.
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a0fec4de-471b-4b6e-8d1c-0317e17aea5a1 parent 5ce1b24 commit 7ddb584
40 files changed
Lines changed: 1495 additions & 75 deletions
File tree
- .github/extensions/replica-prototype
- hub-client
- recall-learnings
- register-prototype-canvas
- hub
- app
- controllers
- canvas_api
- concerns
- javascript/pages/canvas-pairings-page
- models
- views/canvas_pairings
- config
- locales
- db
- migrate
- docs
- test
- fixtures/files
- integration
- packages/learning
- conformance
- src
- providers
- test
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
249 | 255 | | |
250 | 256 | | |
251 | 257 | | |
| |||
570 | 576 | | |
571 | 577 | | |
572 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
573 | 621 | | |
574 | 622 | | |
575 | 623 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
0 commit comments