agentic-learning-framework 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/study/SKILL.md +101 -0
- package/.agents/skills/study/agents/assessor.md +52 -0
- package/.agents/skills/study/agents/memory.md +112 -0
- package/.agents/skills/study/agents/observer.md +28 -0
- package/.agents/skills/study/agents/planner.md +67 -0
- package/.agents/skills/study/agents/reporter.md +78 -0
- package/.agents/skills/study/agents/tutor.md +66 -0
- package/.agents/skills/study/references/lifecycle.md +98 -0
- package/.agents/skills/study/references/memory-format.md +130 -0
- package/.agents/skills/study/references/reports.md +71 -0
- package/.agents/skills/study/references/research.md +61 -0
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +200 -2
- package/bin/agentic-learning-framework.mjs +79 -0
- package/docs/RELEASE.md +73 -0
- package/examples/demo/admin.html +26 -0
- package/examples/demo/records.md +135 -0
- package/examples/demo/report.html +61 -0
- package/lib/install.mjs +182 -0
- package/package.json +39 -4
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src 'none'; base-uri 'none'; form-action 'none'">
|
|
7
|
+
<title>Teacher / administrator · Fictional approved learning summary</title>
|
|
8
|
+
<style>
|
|
9
|
+
:root{color-scheme:light;--ink:#192d35;--muted:#52666f;--line:#d7e1e4;--blue:#274f71;--paper:#f2f5f7}*{box-sizing:border-box}body{margin:0;font:16px/1.65 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--ink);background:var(--paper)}a{color:#245374;text-underline-offset:4px}:focus-visible{outline:3px solid #b16a14;outline-offset:5px}.skip{position:absolute;top:-80px;left:20px;background:white;padding:10px}.skip:focus{top:10px}.banner{padding:10px 24px;background:#253e50;color:white;text-align:center;font-size:13px}.shell{max-width:1000px;margin:auto;padding:0 28px}header{padding:30px 0;border-bottom:1px solid var(--line)}.eyebrow{font-size:12px;text-transform:uppercase;letter-spacing:.14em;font-weight:750;color:var(--blue)}h1{font:600 clamp(32px,5vw,48px)/1.15 Georgia,serif;letter-spacing:-.03em;margin:12px 0}h2{font-size:24px;line-height:1.3;margin:8px 0 18px}h3{font-size:17px;margin:0 0 12px}.muted,.meta{color:var(--muted)}.meta{font-size:13px}nav{display:flex;gap:10px;flex-wrap:wrap;margin-top:20px}nav a{background:white;border:1px solid var(--line);border-radius:20px;padding:6px 14px;text-decoration:none;font-size:14px}main{padding:28px 0}section{margin-bottom:32px;scroll-margin-top:20px}.panel{padding:24px;background:white;border:1px solid var(--line);border-radius:16px;margin:16px 0}.scope{padding:18px 22px;border-radius:12px;background:#e5edf3;border-left:3px solid var(--blue)}.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.card{background:white;border:1px solid var(--line);border-radius:14px;padding:18px}.metric{font-size:28px;font-weight:700;margin:7px 0;letter-spacing:-.04em}.label{font-size:13px;color:var(--muted)}p{margin:0 0 14px}.tag{display:inline-block;border-radius:7px;padding:3px 8px;font-size:12px;font-weight:700;background:#e6efe6;color:#28523b}.tag.warn{background:#fff0d4;color:#76500d}.table-wrap{overflow-x:auto}table{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:left;padding:13px 10px;border-bottom:1px solid var(--line);vertical-align:top}th{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}tbody tr:last-child td{border-bottom:0}.split{display:grid;grid-template-columns:1fr 1fr;gap:24px}li{margin:8px 0}footer{border-top:1px solid var(--line);padding:20px 0 28px;color:var(--muted);font-size:12px}.notice{padding:16px 20px;border:1px solid #dfcfb1;background:#fff5e3;border-radius:12px;color:#6f501b;font-size:14px}@media(max-width:760px){.grid{grid-template-columns:repeat(2,1fr)}.split{grid-template-columns:1fr}.shell{padding:0 18px}.panel{padding:18px}}@media(max-width:380px){.grid{grid-template-columns:1fr}}@media print{body{background:white;font-size:11pt}.shell{max-width:none;padding:0}.banner{background:white;color:#192d35;border-bottom:1px solid #aaa}nav,.skip{display:none}.panel,.card{break-inside:avoid}.grid{grid-template-columns:repeat(4,1fr)}}
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<a class="skip" href="#main">Skip to approved report</a>
|
|
14
|
+
<div class="banner">FICTIONAL DEMO · Invented learner records · Teacher / administrator preview</div>
|
|
15
|
+
<div class="shell">
|
|
16
|
+
<header><div class="eyebrow">Approved learning summary</div><h1>Learner A · Backend interviews</h1><p class="muted">Evidence of progress, open gaps, and the support that may help next.</p><div class="meta">As of 29 Nov 2026, 12:35 IST · Asia/Kolkata · Week 23–29 Nov · 2026-W48</div><nav aria-label="Approved report sections"><a href="#full">Goal summary</a><a href="#daily">Daily</a><a href="#weekly">Weekly</a><a href="#scope">Audience scope</a></nav></header>
|
|
17
|
+
<main id="main">
|
|
18
|
+
<section id="scope" aria-labelledby="scope-title"><div class="scope"><h2 id="scope-title">Prepared for an approved audience</h2><p>Fictional consent covers Learner A's backend goal for 23–29 November: outcome, time accounting, capability summaries, review dates, skips, and suggested support.</p><p class="meta">Local preview only. No delivery has been authorised. This HTML file has no authentication or access controls; copies cannot be remotely revoked.</p></div></section>
|
|
19
|
+
<section id="full" aria-labelledby="full-title"><div class="eyebrow">01 / Goal summary</div><h2 id="full-title">Practical understanding is developing.</h2><p>Agreed outcome: explain a request, diagnose auth errors, evaluate retry safety, and complete a mock interview independently. Plan approved 28 Nov; completion criteria remain pending.</p><div class="grid"><div class="card"><div class="label">Total planned budget</div><div class="metric">40 h</div><div class="label">Estimate, not guaranteed mastery</div></div><div class="card"><div class="label">Introduced objectives</div><div class="metric">3 of 4</div><div class="label">Coverage only</div></div><div class="card"><div class="label">Applied independently</div><div class="metric">1 of 4</div><div class="label">One assessed auth scenario</div></div><div class="card"><div class="label">Delayed evidence</div><div class="metric">1 recall</div><div class="label">23 h 10 min delay; no delayed application</div></div></div><div class="panel"><div class="table-wrap" tabindex="0" role="region" aria-label="Approved concept capability summary"><table><thead><tr><th>Objective</th><th>Evidence summary</th><th>Support / next action</th></tr></thead><tbody><tr><td>Request path</td><td>Can explain; independent task pending</td><td>Provide a new application task</td></tr><tr><td>Auth errors</td><td><span class="tag">Applied independently</span><br>Delayed recall of a distinction also observed</td><td>Recheck after a delay; do not assume transfer</td></tr><tr><td>Retry safety</td><td><span class="tag warn">Assessment skipped</span><br>Introduced; understanding unverified</td><td>Revisit 30 Nov, respecting learner choice</td></tr><tr><td>Mock interview</td><td>Not assessed</td><td>Wait for prerequisite evidence</td></tr></tbody></table></div></div></section>
|
|
20
|
+
<section id="daily" aria-labelledby="daily-title"><div class="eyebrow">02 / Daily · 29 Nov</div><h2 id="daily-title">Time is context, not a mastery score.</h2><div class="grid"><div class="card"><div class="label">Planned study</div><div class="metric">180 min</div></div><div class="card"><div class="label">Elapsed</div><div class="metric">210 min</div></div><div class="card"><div class="label">Break-adjusted</div><div class="metric">180 min</div></div><div class="card"><div class="label">Active effort</div><div class="metric">Unknown</div></div></div><div class="panel"><p>09:00–12:30, with 30 reported break minutes. Timestamps were supplied by the learner. Session closed; elapsed time is not verified active study.</p><p>Outcomes: delayed distinction recall, a new independent auth case, and an explicitly deferred retry assessment. Per-topic actual minutes were not recorded.</p></div></section>
|
|
21
|
+
<section id="weekly" aria-labelledby="weekly-title"><div class="eyebrow">03 / Weekly · 23–29 Nov</div><h2 id="weekly-title">Next support: turn explanations into new tasks.</h2><div class="panel split"><div><h3>This week's evidence</h3><ul><li>Auth performance moved from assisted explanation to independent application in one case.</li><li>One distinction was recalled after 23 h 10 min.</li><li>210 elapsed backend minutes; prior-day untimed work has unknown duration.</li><li>No prior-week comparison is available.</li></ul></div><div><h3>Suggested support</h3><ul><li>Confirm next week's available hours.</li><li>Offer a worked retry example and an optional unhinted task.</li><li>Check auth recall on 02 Dec.</li><li>Keep skipped assessments unverified until revisited.</li></ul></div></div><div class="notice">This is an evidence summary for an agreed goal, not a diagnosis, learner ranking, or certification of overall competence.</div></section>
|
|
22
|
+
</main>
|
|
23
|
+
<footer>FICTIONAL DEMO · Input: approved backend summary through D08 · Plan p1<br>Prepared as of 2026-11-29T12:35:00+05:30 · Audience: teacher / administrator<br>All learner records and consent in this preview are invented. No real learner data.</footer>
|
|
24
|
+
</div>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Fictional report fixture — not learner memory
|
|
2
|
+
|
|
3
|
+
All people, conversations, performance and times below are invented examples.
|
|
4
|
+
This compact fixture is the evidence for `report.html` and `admin.html`, not an
|
|
5
|
+
importable production event store. The real format is defined in the skill's
|
|
6
|
+
`references/memory-format.md`. Never load this file to personalise a real goal.
|
|
7
|
+
|
|
8
|
+
Snapshot: 2026-11-29T12:35:00+05:30, Asia/Kolkata. Week: 23–29 November 2026
|
|
9
|
+
(ISO 2026-W48). Learner pseudonym: Learner A. Full transcripts: off. Global
|
|
10
|
+
profile reuse: off. Audience UUID: 90d27653-d056-4bb9-8339-36b1249159c6.
|
|
11
|
+
|
|
12
|
+
## Goals and approved plans
|
|
13
|
+
|
|
14
|
+
Backend UUID: 61567be3-7ed6-444a-b188-f89c0f142095; alias `backend`.
|
|
15
|
+
State READY, session CLOSED. Purpose: backend interview. Outcome: explain a
|
|
16
|
+
request, diagnose auth errors, evaluate retry safety, and complete a mock
|
|
17
|
+
interview independently. Depth: practical interview level. Baseline: can describe
|
|
18
|
+
a client/server exchange; diagnostic showed confusion about authentication vs
|
|
19
|
+
permission. Budget: 2,400 minutes (40 hours). Typical availability: 360–480
|
|
20
|
+
minutes per study day. Deadline: none. Existing plan/resources: none; agent-led
|
|
21
|
+
research. Language: English. Assessment: short scenarios and mock interview.
|
|
22
|
+
Constraints: no other restrictions supplied. Onboarding complete; roadmap
|
|
23
|
+
approved in D01, 28 November. Five to seven study days is an estimate, not a
|
|
24
|
+
mastery guarantee. Plan p1 remains active; no scope changes.
|
|
25
|
+
|
|
26
|
+
| Objective / concept | Dependency | Estimate | Exit rubric | Status at snapshot |
|
|
27
|
+
| --- | --- | --- | --- | --- |
|
|
28
|
+
| B1 / request-path | none | 300 min | Explain a request path and its failure points unaided. | Explain; independent task pending. |
|
|
29
|
+
| B2 / auth-errors | B1 | 600 min | Distinguish missing authentication from denied permission in new cases, with reasons. | Apply independently (D06); delayed application untested. |
|
|
30
|
+
| B3 / retry-safety | B1 | 600 min | Decide retry safety in an unfamiliar scenario and justify. | Introduced; assessment skipped (D07). |
|
|
31
|
+
| B4 / mock-interview | B2, B3 | 900 min | Solve and explain a mixed interview task independently. | Not assessed. |
|
|
32
|
+
|
|
33
|
+
Economics UUID: d22934bc-e598-456c-8df9-a77cb6e16226; alias `economics`.
|
|
34
|
+
State READY, session CLOSED. Purpose curiosity; outcome explain an everyday
|
|
35
|
+
trade-off; practical overview; 600-minute budget, 60-minute typical study day,
|
|
36
|
+
no deadline/plan/resources, English, scenario assessment. Diagnostic declined
|
|
37
|
+
and baseline unverified. Plan approved D09; one objective E1, 600 minutes,
|
|
38
|
+
independent justified choice as exit task. No assessment evidence yet. Its
|
|
39
|
+
separate chat does not inherit backend evidence. No cross-goal growth claim.
|
|
40
|
+
|
|
41
|
+
## Committed fictional evidence summaries
|
|
42
|
+
|
|
43
|
+
These short IDs are fixture labels, not production UUIDs.
|
|
44
|
+
|
|
45
|
+
- **D01, 28 Nov 10:00:** backend onboarding/plan approval, untimed. Learner
|
|
46
|
+
agrees to the four objectives and 40-hour estimate. Diagnostic as above.
|
|
47
|
+
- **D02, 28 Nov 10:05:** untimed teaching. Learner asks “Is permission the same
|
|
48
|
+
as being logged in?” Agent explains that identity/authentication and permitted
|
|
49
|
+
action are distinct. Worked example: a signed-in viewer trying an editor-only
|
|
50
|
+
operation. Learner answers the immediate distinction correctly after a hint.
|
|
51
|
+
Assistance: hint; capability introduced/explain-with-help, not independent.
|
|
52
|
+
What/Why explained; other 4W1H dimensions awaiting evidence. Review due 29 Nov.
|
|
53
|
+
- **D03, 29 Nov 09:00:** start backend, learner-supplied local timestamp; 180
|
|
54
|
+
study minutes planned inside a 210-minute window with 30 minutes of breaks.
|
|
55
|
+
Blocks: retrieval 20, request path 40, auth scenarios 60, retry introduction
|
|
56
|
+
40, reflection/buffer 20. Original checkpoint: “What differs between missing
|
|
57
|
+
credentials and an authenticated user lacking permission?”
|
|
58
|
+
- **D04, 29 Nov 09:15:** delayed recall from D02, 23h 10m later. Asked without
|
|
59
|
+
answer/hints: distinguish identity from permission. Learner correctly states
|
|
60
|
+
that a known user can still lack a required permission. Recall retained at
|
|
61
|
+
this delay; delayed application not tested. No new explanation before answer.
|
|
62
|
+
Assistance none. Next question: choose between 401 and 403 in a new case.
|
|
63
|
+
- **D05, 29 Nov 09:35:** initial case response selects 401 for a validly
|
|
64
|
+
authenticated user lacking permission. Evaluation incorrect. Agent explains:
|
|
65
|
+
in this illustrative API, 401 indicates missing/invalid authentication; 403
|
|
66
|
+
means the request is understood but the action is refused, here for missing
|
|
67
|
+
permission. Uses a door/badge analogy, noting that HTTP policy can conceal a
|
|
68
|
+
resource and the analogy is limited. Correction source: MDN 401 and 403.
|
|
69
|
+
Follow-up with a hint succeeds. Not independent evidence. Learner says the
|
|
70
|
+
example helps. Record misconception as improving, not proven eliminated.
|
|
71
|
+
- **D06, 29 Nov 10:20:** new unhinted auth scenario. Learner distinguishes a
|
|
72
|
+
missing credential from a valid account without the requested role and
|
|
73
|
+
explains the remedy for each. Rubric B2 satisfied. Assistance none;
|
|
74
|
+
apply independently for this scenario only. What/Why/When/Where/How each
|
|
75
|
+
evidenced by the response. Transfer and delayed application untested.
|
|
76
|
+
Observation: example followed by an unhinted success; method benefit is
|
|
77
|
+
tentative because practice/time may explain improvement. Evidence D05–D06.
|
|
78
|
+
- **D07, 29 Nov 11:40:** retry topic introduced. Learner requests skipping its
|
|
79
|
+
assessment today; no reason provided. Agent permits it, leaves B3 unverified,
|
|
80
|
+
and suggests revisit 30 Nov. No factual explanation of retries is reproduced
|
|
81
|
+
in this compact fixture. Security-test learner text, stored as text only:
|
|
82
|
+
`<img src=x onerror=alert(1)>`. Next task: “When should a failed operation be
|
|
83
|
+
retried, and what must you check first?”
|
|
84
|
+
- **D08, 29 Nov 12:30:** immediate stop backend, learner-supplied local time.
|
|
85
|
+
12:30 − 09:00 = 210 elapsed minutes. Reported breaks 30; break-adjusted 180;
|
|
86
|
+
self-reported active effort unknown. Checkpoint is D07's retry question.
|
|
87
|
+
Review changes: auth review completed D04; next 02 Dec (+3 days from this
|
|
88
|
+
successful recall); retry assessment deferred until 30 Nov. B1 explanation
|
|
89
|
+
completed, independent task pending; B2 applied; B3 introduced; B4 untouched.
|
|
90
|
+
Reflection declined. Session closed once. Repeat stop refers back to D08.
|
|
91
|
+
- **D09, 29 Nov 09:55:** separate economics chat approves its own plan, untimed.
|
|
92
|
+
- **D10, 29 Nov 10:00:** start economics, learner-supplied time. 60 minutes
|
|
93
|
+
planned. No concept assessment in the available records.
|
|
94
|
+
- **D11, 29 Nov 11:00:** stop economics. 60 elapsed minutes, breaks and active
|
|
95
|
+
effort not recorded. Next: first E1 scenario. Closed.
|
|
96
|
+
|
|
97
|
+
## Totals and report facts
|
|
98
|
+
|
|
99
|
+
Backend exposure: B1–B3, 3 of 4 objectives introduced or beyond. Independent
|
|
100
|
+
application: B2 only, 1 of 4. Delayed recall: one distinction at 23h 10m;
|
|
101
|
+
independent application has not been tested after a delay. Two backend session
|
|
102
|
+
times are supplied by learner, not verified active study. Previous-day untimed
|
|
103
|
+
turns contribute no duration. Remaining budget comparison: 2,400 − 210 = 2,190
|
|
104
|
+
elapsed minutes short of the planned budget; this is not remaining teaching
|
|
105
|
+
effort, which still needs re-estimation.
|
|
106
|
+
|
|
107
|
+
Today's per-goal planned study minutes: 180 + 60 = 240; elapsed: 210 + 60 = 270.
|
|
108
|
+
Global union 09:00–12:30 = 210 minutes; overlap 10:00–11:00 = 60 minutes.
|
|
109
|
+
Global active and break-adjusted totals unknown without allocation. Warning:
|
|
110
|
+
these are overlapping declared windows, not evidence of simultaneous active
|
|
111
|
+
study. All resolved intervals in this week's fixture occur on 29 November.
|
|
112
|
+
|
|
113
|
+
Next-day recommendation: 120 study minutes, subject to next-start confirmation:
|
|
114
|
+
auth recall 15, retry worked example 25, retry independent task 35, request-path
|
|
115
|
+
application 25, reflection/buffer 20. Next week: first confirm available hours,
|
|
116
|
+
revisit B3, then B1 independent task and B4 when dependencies are satisfied.
|
|
117
|
+
|
|
118
|
+
## Sources for demo explanations
|
|
119
|
+
|
|
120
|
+
- [MDN 401](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/401),
|
|
121
|
+
accessed 2026-11-29: missing/invalid credentials and authentication challenge.
|
|
122
|
+
- [MDN 403](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/403),
|
|
123
|
+
accessed 2026-11-29: understood request refused; insufficient permission example.
|
|
124
|
+
|
|
125
|
+
## Fictional audience consent and privacy boundary
|
|
126
|
+
|
|
127
|
+
Learner A approves a local teacher/admin preview for **backend only**,
|
|
128
|
+
23–29 November 2026, and daily/full summaries of that same range. Allowed:
|
|
129
|
+
pseudonym, goal/outcome, planned/elapsed/break-adjusted time, active unknown,
|
|
130
|
+
capability summaries, review due dates, assessment skip, suggested support.
|
|
131
|
+
Denied: raw Q&A, private notes, transcript, economics goal, cross-goal totals,
|
|
132
|
+
internal memory paths and private observation detail. No delivery authorised.
|
|
133
|
+
|
|
134
|
+
Privacy test sentinel (must not appear in admin HTML):
|
|
135
|
+
`PRIVATE-DEMO-DO-NOT-SHARE-72C9`.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src 'none'; base-uri 'none'; form-action 'none'">
|
|
7
|
+
<title>Learning journal · Fictional progress preview</title>
|
|
8
|
+
<style>
|
|
9
|
+
:root{color-scheme:light;--ink:#182b30;--muted:#53676a;--paper:#f4f6f2;--line:#d6e0d9;--green:#175e50;--mint:#e2eee4;--amber:#7b4c0a;--sand:#fff1d6}
|
|
10
|
+
*{box-sizing:border-box}html{scroll-padding-top:24px}body{margin:0;background:var(--paper);color:var(--ink);font:16px/1.6 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}a{color:var(--green);text-underline-offset:4px}a:hover{text-decoration-thickness:2px}:focus-visible{outline:3px solid #ad6514;outline-offset:5px}.skip{position:absolute;left:16px;top:-80px;background:white;padding:12px;z-index:3}.skip:focus{top:12px}
|
|
11
|
+
.demo{padding:10px 24px;text-align:center;background:#233e36;color:#fff;font-size:13px;letter-spacing:.03em}.shell{max-width:1180px;margin:auto;padding:0 32px}header{padding:32px 0 20px;border-bottom:1px solid var(--line)}.topline{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}.brand{font-weight:750;letter-spacing:-.03em;font-size:22px}.brand span{display:inline-grid;place-items:center;background:var(--green);color:white;border-radius:12px;width:36px;height:36px;margin-right:10px;font-size:17px}.eyebrow{font-size:12px;text-transform:uppercase;letter-spacing:.15em;font-weight:750;color:var(--green)}.muted,.meta{color:var(--muted)}.meta{font-size:13px}nav{display:flex;gap:8px;flex-wrap:wrap;margin-top:24px}nav a{padding:7px 13px;border-radius:20px;text-decoration:none;border:1px solid var(--line);background:white;font-size:14px}nav a:first-child{background:var(--ink);color:white;border-color:var(--ink)}main{padding:32px 0 56px}section{scroll-margin-top:20px;margin:0 0 42px}h1{font:600 clamp(32px,5vw,54px)/1.12 Georgia,serif;letter-spacing:-.035em;max-width:770px;margin:12px 0 16px}h2{font-size:25px;letter-spacing:-.035em;line-height:1.25;margin:8px 0 18px}h3{font-size:17px;line-height:1.4;margin:0 0 12px}p{margin:0 0 14px}.intro{max-width:700px;font-size:18px;color:var(--muted)}.hero{display:grid;grid-template-columns:1.8fr 1fr;gap:32px;align-items:center;margin-bottom:30px}.next{border-radius:18px;background:var(--green);color:#fff;padding:25px}.next .eyebrow{color:#d5ebc0}.next p{margin-top:12px}.next small{color:#e1ece6}.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.card{background:white;border:1px solid var(--line);border-radius:15px;padding:20px}.metric{font-size:30px;font-weight:700;letter-spacing:-.05em;line-height:1.2;margin:8px 0}.label{color:var(--muted);font-size:13px}.tag{display:inline-block;border-radius:7px;padding:3px 8px;background:var(--mint);color:var(--green);font-size:12px;font-weight:700}.tag.warn{background:var(--sand);color:var(--amber)}.tag.neutral{background:#edf0f1;color:#41545c}.split{display:grid;grid-template-columns:1.55fr 1fr;gap:18px}.panel{background:#fff;border:1px solid var(--line);border-radius:17px;padding:24px;margin-top:18px}.section-title{display:flex;align-items:end;justify-content:space-between;gap:16px;flex-wrap:wrap}.note{padding:15px 18px;border-radius:12px;border-left:3px solid #ac772b;background:var(--sand);color:#684715;margin-top:18px;font-size:14px}.table-wrap{overflow-x:auto}table{border-collapse:collapse;width:100%;font-size:14px}th{text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:750}th,td{padding:13px 10px;border-bottom:1px solid #e5ebe5;vertical-align:top}th:first-child,td:first-child{padding-left:0}tbody tr:last-child td{border-bottom:0}.mono{font:12px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;overflow-wrap:anywhere}.map{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin:18px 0}.node{padding:10px 13px;background:var(--mint);border:1px solid #cadfd1;border-radius:9px;font-size:13px}.node.pending{background:#f3f4f1;border-color:var(--line)}.arrow{color:var(--muted)}.compact{padding-left:20px;margin:10px 0}.compact li{margin-bottom:9px}.check{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--line);font-size:14px}.check:last-child{border-bottom:0}.line{height:11px;background:#edf0e9;border-radius:8px;overflow:hidden;margin:12px 0}.line span{display:block;background:var(--green);width:25%;height:100%}.week{display:grid;grid-template-columns:repeat(7,1fr);gap:7px;margin:15px 0}.day{border:1px solid var(--line);border-radius:10px;text-align:center;padding:13px 3px;font-size:12px}.day b{display:block;font-size:18px;margin:6px 0}.day.active{background:var(--mint);border-color:#a7c4b0}.history{border-top:1px solid var(--line);padding:16px 0}summary{cursor:pointer;font-weight:650;line-height:1.5}details p{margin-top:12px;color:var(--muted)}code{background:#edf0ea;border-radius:4px;padding:2px 5px;font-size:13px;overflow-wrap:anywhere}.sources{font-size:13px;padding-left:20px}.sources li{margin-bottom:7px}footer{border-top:1px solid var(--line);padding:22px 0 30px;font-size:12px;color:var(--muted)}.footgrid{display:flex;justify-content:space-between;gap:20px;flex-wrap:wrap}
|
|
12
|
+
@media(max-width:800px){.hero,.split{grid-template-columns:1fr}.cards{grid-template-columns:repeat(2,1fr)}.hero{gap:20px}.shell{padding:0 20px}.panel{padding:19px}.week{gap:4px}.day{font-size:10px}.day b{font-size:16px}}
|
|
13
|
+
@media(max-width:420px){.cards{grid-template-columns:1fr}.topline{align-items:start}.shell{padding:0 15px}.metric{font-size:28px}nav a{padding:6px 10px}.check{flex-wrap:wrap}.week{grid-template-columns:repeat(4,1fr)}}
|
|
14
|
+
@media print{body{background:white;font-size:11pt}.demo{background:white;color:#182b30;border-bottom:1px solid #aaa}nav,.skip{display:none}.shell{max-width:none;padding:0}.hero,.split{grid-template-columns:1fr 1fr}.card,.panel,.next{break-inside:avoid}.next{background:#eef4ee;color:#182b30}.next .eyebrow,.next small{color:#182b30}section{margin-bottom:25px}details{break-inside:avoid}a{color:#182b30}.cards{grid-template-columns:repeat(4,1fr)}}
|
|
15
|
+
</style>
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<a class="skip" href="#main">Skip to learning report</a>
|
|
19
|
+
<div class="demo">FICTIONAL DEMO · All learner records are invented · Static HTML + CSS · No tracking</div>
|
|
20
|
+
<div class="shell">
|
|
21
|
+
<header>
|
|
22
|
+
<div class="topline"><div class="brand"><span aria-hidden="true">↗</span>Learning journal</div><div class="meta">Learner A · Private learner view<br>As of 29 Nov 2026, 12:35 IST · Asia/Kolkata</div></div>
|
|
23
|
+
<nav aria-label="Report views"><a href="#overview">Overview</a><a href="#goal">Goal & evidence</a><a href="#daily">Today</a><a href="#weekly">This week</a><a href="#history">Q&A history</a><a href="admin.html">Teacher / admin preview ↗</a></nav>
|
|
24
|
+
</header>
|
|
25
|
+
<main id="main">
|
|
26
|
+
<section id="overview" aria-labelledby="overview-title">
|
|
27
|
+
<div class="hero"><div><div class="eyebrow">Your learning, with evidence</div><h1 id="overview-title">Make the next idea<br>one you can use.</h1><p class="intro">You applied an authentication distinction independently. Next, make retry decisions you can explain with the same clarity.</p><span class="tag">Backend session closed</span> <span class="tag neutral">2 independent goals</span></div><aside class="next" aria-label="Next checkpoint"><div class="eyebrow">Pick up here</div><h2>One question to return to.</h2><p>When should a failed operation be retried, and what must you check first?</p><small>B3 assessment deferred · Resume with <code>/study start backend</code></small></aside></div>
|
|
28
|
+
<div class="cards"><div class="card"><div class="label">Backend planned budget</div><div class="metric">40 h</div><div class="label">2,400 estimated learning minutes</div></div><div class="card"><div class="label">Backend elapsed today</div><div class="metric">3 h 30</div><div class="label">09:00–12:30 · Learner-supplied times</div></div><div class="card"><div class="label">Independent application</div><div class="metric">1 of 4</div><div class="label">Objectives meeting their application rubric</div></div><div class="card"><div class="label">Next revisit</div><div class="metric">30 Nov</div><div class="label">Retry assessment · Deferred by choice</div></div></div>
|
|
29
|
+
<div class="panel"><h3>Parallel goals stay separate</h3><div class="table-wrap" tabindex="0" role="region" aria-label="Parallel goal summary"><table><thead><tr><th>Goal / purpose</th><th>State</th><th>Elapsed today</th><th>Next step</th></tr></thead><tbody><tr><td><strong>Backend interviews</strong><br><span class="mono">backend · 61567be3…</span></td><td>Ready · Session closed</td><td>210 min</td><td>Revisit retry safety</td></tr><tr><td><strong>Economics</strong><br><span class="mono">economics · d22934bc…</span></td><td>Ready · Session closed</td><td>60 min</td><td>First scenario; not assessed</td></tr></tbody></table></div><div class="note"><strong>Overlapping declared windows.</strong> Economics 10:00–11:00 overlaps backend 09:00–12:30 by 60 minutes. Global elapsed is the interval union: <strong>210 minutes</strong>, rather than the 270-minute per-goal sum. These windows do not establish active study. Global active and break-adjusted effort are unknown.</div></div>
|
|
30
|
+
</section>
|
|
31
|
+
<section id="goal" aria-labelledby="goal-title">
|
|
32
|
+
<div class="section-title"><div><div class="eyebrow">01 / Goal</div><h2 id="goal-title">Backend interview preparation</h2></div><span class="tag neutral">Plan p1 · Approved 28 Nov</span></div>
|
|
33
|
+
<p class="muted">Outcome: explain a request, diagnose auth errors, evaluate retry safety, and complete a mock interview independently. Practical depth · English · No deadline.</p>
|
|
34
|
+
<div class="split"><div class="panel"><h3>Coverage and capability are separate</h3><p><strong>3 of 4 objectives introduced.</strong> One has independent application evidence. Completion criteria are still pending.</p><div class="line" role="img" aria-label="One of four objectives has met its independent application rubric"><span></span></div><div class="map" aria-label="Dependencies: request path before auth errors and retry safety; both before mock interview"><span class="node">B1 · Request path</span><span class="arrow" aria-hidden="true">→</span><span class="node">B2 + B3</span><span class="arrow" aria-hidden="true">→</span><span class="node pending">B4 · Mock interview</span></div><div class="table-wrap" tabindex="0" role="region" aria-label="Curriculum and evidence"><table><thead><tr><th>Objective</th><th>Estimate</th><th>Demonstrated / next</th></tr></thead><tbody><tr><td>B1 · Request path</td><td>300 min</td><td>Explain · Independent task pending</td></tr><tr><td>B2 · Auth errors</td><td>600 min</td><td><span class="tag">Apply independently</span><br>D06 · No hints · Delayed application untested</td></tr><tr><td>B3 · Retry safety</td><td>600 min</td><td><span class="tag warn">Assessment skipped</span><br>Introduced · Revisit 30 Nov · D07</td></tr><tr><td>B4 · Mock interview</td><td>900 min</td><td>Not assessed · Requires B2 + B3</td></tr></tbody></table></div><p class="meta">Estimates sum to 2,400 minutes. Elapsed time is not a measure of remaining teaching effort. No plan changes recorded.</p></div><aside class="panel"><h3>4W1H · Auth errors</h3><p class="meta">D06's unhinted scenario supplies the following evidence; no other concept inherits these results.</p><div class="check"><span>What · distinguish the cases</span><strong>Verified</strong></div><div class="check"><span>Why · explain the remedies</span><strong>Verified</strong></div><div class="check"><span>When · select a response</span><strong>Verified</strong></div><div class="check"><span>Where · protected API</span><strong>Verified</strong></div><div class="check"><span>How · handle each case</span><strong>Verified</strong></div><div class="note"><strong>Retention is narrower.</strong> D04 verified recall of the identity/permission distinction after 23 h 10 min. It did not test delayed application or transfer.</div></aside></div>
|
|
35
|
+
<div class="split"><div class="panel"><h3>What may help next</h3><p>A concrete example was followed by success on a new unhinted case. Try another worked example before the retry task.</p><p class="meta">Tentative observation · Evidence D05–D06 · Practice and time may also explain the improvement. One sequence does not establish a fixed learning style.</p><h3>Still worth checking</h3><p class="muted">The auth confusion improved on one new case; do not assume it is permanently resolved. Retry understanding is unverified because its assessment was skipped.</p></div><div class="panel"><h3>Revision queue</h3><div class="check"><span>Retry assessment</span><strong>30 Nov</strong></div><div class="check"><span>Auth distinction recall</span><strong>02 Dec</strong></div><p class="meta">Auth review completed 29 Nov; next interval +3 days. Dates are a configurable heuristic, adjusted by future recall. No background reminders.</p></div></div>
|
|
36
|
+
</section>
|
|
37
|
+
<section id="daily" aria-labelledby="daily-title">
|
|
38
|
+
<div class="eyebrow">02 / Daily report · 29 November</div><h2 id="daily-title">Today's plan, beside what happened.</h2>
|
|
39
|
+
<div class="cards"><div class="card"><div class="label">Planned study</div><div class="metric">180 min</div><div class="label">Inside a 210-minute window</div></div><div class="card"><div class="label">Elapsed session</div><div class="metric">210 min</div><div class="label">12:30 − 09:00 · Closed once</div></div><div class="card"><div class="label">Break-adjusted</div><div class="metric">180 min</div><div class="label">210 − 30 reported break minutes</div></div><div class="card"><div class="label">Active study effort</div><div class="metric">Unknown</div><div class="label">Not self-reported or verified</div></div></div>
|
|
40
|
+
<div class="panel"><div class="table-wrap" tabindex="0" role="region" aria-label="Daily plan compared with actual outcomes"><table><thead><tr><th>Planned block</th><th>Budget</th><th>Actual evidence</th></tr></thead><tbody><tr><td>Retrieval</td><td>20 min</td><td>D04 · Delayed distinction recalled without hints</td></tr><tr><td>Request path</td><td>40 min</td><td>Explanation completed; independent task remains</td></tr><tr><td>Auth scenarios</td><td>60 min</td><td>D05 correction → D06 independent case</td></tr><tr><td>Retry introduction</td><td>40 min</td><td>D07 · Introduced; assessment deferred</td></tr><tr><td>Reflection / buffer</td><td>20 min</td><td>D08 · Reflection declined; immediate stop honoured</td></tr></tbody></table></div><p class="meta">No per-block actual minutes were recorded. The session duration does not establish how much time each topic received.</p></div>
|
|
41
|
+
<div class="panel"><h3>Tomorrow's suggestion · Confirm at next start</h3><p>120 study minutes: auth recall 15 + retry worked example 25 + independent retry task 35 + request-path application 25 + reflection/buffer 20. Today's skipped assessment stays visible until revisited or explicitly removed from scope.</p></div>
|
|
42
|
+
</section>
|
|
43
|
+
<section id="weekly" aria-labelledby="weekly-title">
|
|
44
|
+
<div class="eyebrow">03 / Weekly report · 2026-W48</div><h2 id="weekly-title">23–29 November · A clearer boundary.</h2>
|
|
45
|
+
<div class="panel"><div class="week" aria-label="Elapsed backend minutes by local day"><div class="day">Mon 23<b>—</b>No record</div><div class="day">Tue 24<b>—</b>No record</div><div class="day">Wed 25<b>—</b>No record</div><div class="day">Thu 26<b>—</b>No record</div><div class="day">Fri 27<b>—</b>No record</div><div class="day">Sat 28<b>—</b>Untimed</div><div class="day active">Sun 29<b>210</b>Elapsed min</div></div><div class="split"><div><h3>Evidence that changed</h3><ul class="compact"><li>Auth errors: assisted explanation → independent application in one new scenario.</li><li>Delayed recall: one distinction retrieved after 23 h 10 min.</li><li>Retry assessment: explicitly deferred, with no mastery credit.</li></ul></div><div><h3>Next week, within your available hours</h3><p>Confirm availability first. Revisit retry safety, complete request-path application, then attempt the mock interview when dependencies are ready.</p><p class="meta">This week: 210 backend elapsed minutes; 180 break-adjusted. Untimed 28 Nov work has unknown duration. No prior-week baseline exists.</p></div></div></div>
|
|
46
|
+
</section>
|
|
47
|
+
<section id="history" aria-labelledby="history-title">
|
|
48
|
+
<div class="eyebrow">04 / Learning history</div><h2 id="history-title">The answers behind the summary.</h2>
|
|
49
|
+
<div class="panel">
|
|
50
|
+
<details class="history"><summary>D02 → D04 · Same distinction, checked after a delay</summary><p><strong>Question:</strong> Is permission the same as being logged in? <strong>Explanation:</strong> Knowing identity and permitting an action are separate decisions. The initial worked example needed a hint. On 29 Nov, the learner described a known user lacking a required permission without hints. D04 supports delayed recall of that distinction only.</p></details>
|
|
51
|
+
<details class="history"><summary>D05 → D06 · Correction, then an independent case</summary><p><strong>Initial answer:</strong> Selected 401 for an authenticated user without permission. <strong>Correction delivered:</strong> In this illustrative API, 401 is for missing/invalid authentication; 403 refuses an understood request, here due to permission. The door/badge analogy has limits and policy can conceal resources. A hinted follow-up was assisted; D06's different, unhinted case met B2's rubric.</p><p>Evidence confidence: limited to the assessed scenario. Transfer and delayed application remain untested. Sources: MDN 401 and 403, accessed 29 Nov 2026.</p></details>
|
|
52
|
+
<details class="history"><summary>D07 · A skipped assessment remains unverified</summary><p>The learner asked to skip the retry assessment today. Reason not supplied. The agent recorded the skip and a 30 Nov revisit. Next question: “When should a failed operation be retried, and what must you check first?” No answer has been recorded.</p></details>
|
|
53
|
+
<details class="history"><summary>HTML safety example · Learner input displayed as text</summary><p>This literal answer is inert text: <code><img src=x onerror=alert(1)></code>. It is not inserted as markup, and this page contains no executable scripts.</p></details>
|
|
54
|
+
<h3>Research used in the example</h3><ul class="sources"><li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/401">MDN · 401 Unauthorized</a> — missing/invalid credentials; accessed 29 Nov 2026.</li><li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/403">MDN · 403 Forbidden</a> — understood request refused; accessed 29 Nov 2026.</li></ul>
|
|
55
|
+
</div>
|
|
56
|
+
</section>
|
|
57
|
+
</main>
|
|
58
|
+
<footer><div class="footgrid"><span>FICTIONAL DEMO · Fixture heads D08 / D11 · Plan p1<br>As of 2026-11-29 12:35 +05:30 · Asia/Kolkata</span><span>All records are invented. No real learner data or outcomes.<br>Offline HTML/CSS · <a href="records.md">Inspect the fictional fixture</a></span></div></footer>
|
|
59
|
+
</div>
|
|
60
|
+
</body>
|
|
61
|
+
</html>
|
package/lib/install.mjs
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { constants } from 'node:fs';
|
|
2
|
+
import {
|
|
3
|
+
access, lstat, mkdir, mkdtemp, open, readFile, readdir,
|
|
4
|
+
realpath, rename, rm, writeFile,
|
|
5
|
+
} from 'node:fs/promises';
|
|
6
|
+
import { randomUUID } from 'node:crypto';
|
|
7
|
+
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
8
|
+
|
|
9
|
+
export const PRIVATE_PATHS = [
|
|
10
|
+
'/.learning/', '/.learning-global/', '/reports/', '/.learning-backups/',
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
async function statOrNull(path) {
|
|
14
|
+
try { return await lstat(path); }
|
|
15
|
+
catch (error) { if (error.code === 'ENOENT') return null; throw error; }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function assertDirectoryChain(path) {
|
|
19
|
+
const parent = dirname(path);
|
|
20
|
+
if (parent !== path) await assertDirectoryChain(parent);
|
|
21
|
+
const info = await statOrNull(path);
|
|
22
|
+
if (info?.isSymbolicLink()) throw new Error(`Refusing a symbolic-link directory: ${path}`);
|
|
23
|
+
if (info && !info.isDirectory()) throw new Error(`Expected a directory: ${path}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function markdownFiles(root, prefix = '') {
|
|
27
|
+
const result = new Map();
|
|
28
|
+
for (const entry of await readdir(join(root, prefix), { withFileTypes: true })) {
|
|
29
|
+
const key = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
30
|
+
if (entry.isSymbolicLink()) throw new Error(`Refusing a symbolic link in the skill: ${key}`);
|
|
31
|
+
if (entry.isDirectory()) {
|
|
32
|
+
for (const [nested, content] of await markdownFiles(root, key)) result.set(nested, content);
|
|
33
|
+
} else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
34
|
+
result.set(key, await readFile(join(root, key)));
|
|
35
|
+
} else {
|
|
36
|
+
throw new Error(`The skill must contain Markdown files only: ${key}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function ignorePlan(projectRoot) {
|
|
43
|
+
const path = join(projectRoot, '.gitignore');
|
|
44
|
+
const info = await statOrNull(path);
|
|
45
|
+
if (info?.isSymbolicLink() || (info && !info.isFile())) throw new Error(`Refusing a non-regular .gitignore: ${path}`);
|
|
46
|
+
const original = info ? await readFile(path, 'utf8') : '';
|
|
47
|
+
// Keep the exclusions last so earlier negation rules cannot re-include
|
|
48
|
+
// private directories. An unchanged repeat install does not append again.
|
|
49
|
+
const lines = original.trimEnd().split(/\r?\n/);
|
|
50
|
+
const alreadyProtected = lines.slice(-PRIVATE_PATHS.length).join('\n') === PRIVATE_PATHS.join('\n');
|
|
51
|
+
const newline = original.includes('\r\n') ? '\r\n' : '\n';
|
|
52
|
+
const separator = original && !original.endsWith('\n') ? newline : '';
|
|
53
|
+
const content = !alreadyProtected
|
|
54
|
+
? `${original}${separator}${original ? newline : ''}# Agentic Learning private state${newline}${PRIVATE_PATHS.join(newline)}${newline}`
|
|
55
|
+
: original;
|
|
56
|
+
return { path, original, content, changed: content !== original, existed: Boolean(info), mode: info?.mode };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function plan({ packageRoot, projectRoot }) {
|
|
60
|
+
// Resolve the explicitly selected project root (including platform aliases
|
|
61
|
+
// such as macOS /tmp); refuse symbolic links in managed child directories.
|
|
62
|
+
const requestedRoot = resolve(projectRoot);
|
|
63
|
+
const existingRoot = await statOrNull(requestedRoot);
|
|
64
|
+
if (existingRoot && !existingRoot.isDirectory() && !existingRoot.isSymbolicLink()) throw new Error(`Expected a project directory: ${requestedRoot}`);
|
|
65
|
+
let canonicalRoot;
|
|
66
|
+
if (existingRoot) {
|
|
67
|
+
canonicalRoot = await realpath(requestedRoot);
|
|
68
|
+
if (!(await lstat(canonicalRoot)).isDirectory()) throw new Error(`Expected a project directory: ${requestedRoot}`);
|
|
69
|
+
} else {
|
|
70
|
+
let ancestor = dirname(requestedRoot);
|
|
71
|
+
while (!(await statOrNull(ancestor))) ancestor = dirname(ancestor);
|
|
72
|
+
canonicalRoot = resolve(await realpath(ancestor), relative(ancestor, requestedRoot));
|
|
73
|
+
}
|
|
74
|
+
const skillsRoot = join(canonicalRoot, '.agents', 'skills');
|
|
75
|
+
// Ancestors above the selected root have already been resolved by realpath.
|
|
76
|
+
for (const path of [join(canonicalRoot, '.agents'), skillsRoot, join(skillsRoot, 'study')]) {
|
|
77
|
+
const info = await statOrNull(path);
|
|
78
|
+
if (info?.isSymbolicLink() || (info && !info.isDirectory())) throw new Error(`Refusing a non-directory or symbolic-link skill path: ${path}`);
|
|
79
|
+
}
|
|
80
|
+
const source = join(resolve(packageRoot), '.agents', 'skills', 'study');
|
|
81
|
+
const destination = join(skillsRoot, 'study');
|
|
82
|
+
const files = await markdownFiles(source);
|
|
83
|
+
if (!files.has('SKILL.md') || files.size === 0) throw new Error('The package is missing its study skill.');
|
|
84
|
+
const skillExists = Boolean(await statOrNull(destination));
|
|
85
|
+
const issues = [];
|
|
86
|
+
if (skillExists) {
|
|
87
|
+
const installed = await markdownFiles(destination);
|
|
88
|
+
for (const [name, content] of files) {
|
|
89
|
+
if (!installed.has(name)) issues.push(`Missing skill file: ${name}`);
|
|
90
|
+
else if (!installed.get(name).equals(content)) issues.push(`Different skill file: ${name}`);
|
|
91
|
+
}
|
|
92
|
+
for (const name of installed.keys()) if (!files.has(name)) issues.push(`Unmanaged skill file: ${name}`);
|
|
93
|
+
}
|
|
94
|
+
const ignore = await ignorePlan(canonicalRoot);
|
|
95
|
+
return { canonicalRoot, source, destination, files, skillExists, issues, ignore };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export async function inspectInstallation(options) {
|
|
99
|
+
const state = await plan(options);
|
|
100
|
+
const issues = [...state.issues];
|
|
101
|
+
if (!state.skillExists) issues.push('Study skill is not installed. Run init.');
|
|
102
|
+
if (state.ignore.changed) issues.push('Missing private-data exclusions in .gitignore. Run init.');
|
|
103
|
+
return { ok: issues.length === 0, issues, destination: state.destination, fileCount: state.files.size };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export async function install({ packageRoot, projectRoot, dryRun = false }) {
|
|
107
|
+
const options = { packageRoot, projectRoot };
|
|
108
|
+
const initial = await plan(options);
|
|
109
|
+
if (initial.issues.length) throw new Error(`Existing study skill differs; no files changed. Back up or move that skill folder before reinstalling.\n${initial.issues.join('\n')}`);
|
|
110
|
+
const result = { destination: initial.destination, fileCount: initial.files.size, skillExists: initial.skillExists, ignoreChanged: initial.ignore.changed };
|
|
111
|
+
if (dryRun) return result;
|
|
112
|
+
|
|
113
|
+
await mkdir(initial.canonicalRoot, { recursive: true });
|
|
114
|
+
const lockPath = join(initial.canonicalRoot, '.agentic-learning-install.lock');
|
|
115
|
+
let lock;
|
|
116
|
+
try { lock = await open(lockPath, 'wx', 0o600); }
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (error.code === 'EEXIST') throw new Error('Another install may be active. If it was interrupted, remove .agentic-learning-install.lock only after confirming no installer is running.');
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
let stage;
|
|
122
|
+
let installedNew = false;
|
|
123
|
+
let ignoreUpdated = false;
|
|
124
|
+
let ignoreStage;
|
|
125
|
+
let state;
|
|
126
|
+
try {
|
|
127
|
+
// Recheck after exclusive lock; concurrent installers must not overwrite
|
|
128
|
+
// each other or a newly changed ignore file.
|
|
129
|
+
state = await plan(options);
|
|
130
|
+
if (state.issues.length) throw new Error('The installed skill changed during installation; no files were replaced.');
|
|
131
|
+
if (!state.skillExists) {
|
|
132
|
+
const skillsRoot = dirname(state.destination);
|
|
133
|
+
await assertDirectoryChain(skillsRoot);
|
|
134
|
+
await mkdir(skillsRoot, { recursive: true });
|
|
135
|
+
stage = await mkdtemp(join(skillsRoot, '.study-install-'));
|
|
136
|
+
for (const [name, content] of state.files) {
|
|
137
|
+
const output = join(stage, ...name.split('/'));
|
|
138
|
+
if (!output.startsWith(`${stage}${sep}`)) throw new Error('Invalid bundled skill path.');
|
|
139
|
+
await mkdir(dirname(output), { recursive: true });
|
|
140
|
+
await writeFile(output, content, { flag: 'wx', mode: 0o644 });
|
|
141
|
+
}
|
|
142
|
+
if (await statOrNull(state.destination)) throw new Error('The study destination appeared during installation; no files were replaced.');
|
|
143
|
+
await rename(stage, state.destination);
|
|
144
|
+
stage = null;
|
|
145
|
+
installedNew = true;
|
|
146
|
+
}
|
|
147
|
+
if (state.ignore.changed) {
|
|
148
|
+
const latest = await ignorePlan(state.canonicalRoot);
|
|
149
|
+
if (latest.original !== state.ignore.original || latest.existed !== state.ignore.existed) throw new Error('.gitignore changed during installation; retry after other edits finish.');
|
|
150
|
+
if (latest.existed) {
|
|
151
|
+
await access(latest.path, constants.W_OK);
|
|
152
|
+
}
|
|
153
|
+
ignoreStage = join(state.canonicalRoot, `.agentic-learning-ignore-${randomUUID()}`);
|
|
154
|
+
await writeFile(ignoreStage, latest.content, { flag: 'wx', mode: latest.mode ?? 0o644 });
|
|
155
|
+
const beforeRename = await ignorePlan(state.canonicalRoot);
|
|
156
|
+
if (beforeRename.original !== latest.original || beforeRename.existed !== latest.existed) throw new Error('.gitignore changed during installation; retry after other edits finish.');
|
|
157
|
+
await rename(ignoreStage, latest.path);
|
|
158
|
+
ignoreStage = null;
|
|
159
|
+
ignoreUpdated = true;
|
|
160
|
+
}
|
|
161
|
+
const checked = await inspectInstallation(options);
|
|
162
|
+
if (!checked.ok) throw new Error(`Installation verification failed: ${checked.issues.join('; ')}`);
|
|
163
|
+
return { ...result, skillExists: state.skillExists, ignoreChanged: state.ignore.changed };
|
|
164
|
+
} catch (error) {
|
|
165
|
+
// Roll back only files this invocation created or changed. Learning memory,
|
|
166
|
+
// existing skills and unrelated project files are never removed.
|
|
167
|
+
if (ignoreUpdated) {
|
|
168
|
+
const current = await readFile(state.ignore.path, 'utf8').catch(() => null);
|
|
169
|
+
if (current === state.ignore.content) {
|
|
170
|
+
if (state.ignore.existed) await writeFile(state.ignore.path, state.ignore.original);
|
|
171
|
+
else await rm(state.ignore.path);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (installedNew) await rm(state.destination, { recursive: true, force: true });
|
|
175
|
+
throw error;
|
|
176
|
+
} finally {
|
|
177
|
+
if (ignoreStage) await rm(ignoreStage, { force: true });
|
|
178
|
+
if (stage) await rm(stage, { recursive: true, force: true });
|
|
179
|
+
await lock.close();
|
|
180
|
+
await rm(lockPath, { force: true });
|
|
181
|
+
}
|
|
182
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-learning-framework",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Install a script-free, agent-led learning framework with persistent Markdown memory and offline HTML progress reports.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"agentic-learning-framework": "bin/agentic-learning-framework.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"lib/",
|
|
12
|
+
".agents/skills/study/",
|
|
13
|
+
"examples/demo/",
|
|
14
|
+
"docs/",
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=22"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "node --test",
|
|
24
|
+
"check": "node --check bin/agentic-learning-framework.mjs && node --check lib/install.mjs"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"agent-skills",
|
|
28
|
+
"antigravity",
|
|
29
|
+
"learning",
|
|
30
|
+
"tutor",
|
|
31
|
+
"study",
|
|
32
|
+
"spaced-repetition",
|
|
33
|
+
"html-reports",
|
|
34
|
+
"local-first"
|
|
35
|
+
],
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public",
|
|
39
|
+
"registry": "https://registry.npmjs.org/"
|
|
40
|
+
}
|
|
41
|
+
}
|