cortad 0.2.3 → 0.3.0-rc.10
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/README.md +11 -2
- package/lib/cli.mjs +90 -38
- package/lib/home.mjs +9 -2
- package/lib/mcp.mjs +32 -12
- package/lib/pyhook/sitecustomize.py +396 -11
- package/lib/read-text.mjs +91 -0
- package/lib/register.mjs +64 -30
- package/lib/replay.mjs +43 -5
- package/lib/spec.mjs +20 -0
- package/lib/start.mjs +10 -0
- package/lib/stick.mjs +99 -0
- package/lib/text.mjs +268 -0
- package/lib/trace.cjs +303 -9
- package/lib/verbs.mjs +148 -107
- package/lib/words.mjs +37 -0
- package/local.mjs +47 -10
- package/package.json +6 -1
- package/skill/SKILL.md +75 -31
- package/skill/references/results.md +175 -34
|
@@ -1,73 +1,214 @@
|
|
|
1
|
-
# What each
|
|
1
|
+
# What each tool prints
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Each result exactly as the tool returns it. The numbers are from a walk of a tutoring app; yours differ. Every tool is also `npx {{cortad}} <tool>` in a shell, with the same output.
|
|
4
|
+
|
|
5
|
+
A reading is one question checked against one reply. A line that starts with `For the person:` is for the person. The last line of a run_status result is the next call.
|
|
4
6
|
|
|
5
7
|
## status
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
Right after a connect, before the read is done:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Cortad · tutor-app
|
|
13
|
+
Free: 1 of 1 run left this month, 60 of 60 verify trials left.
|
|
14
|
+
App: Your app is starting on this machine.
|
|
15
|
+
No run yet.
|
|
16
|
+
Production: not connected.
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Once the read is done and the first run is playing. This is what the person is walked through: the journeys, the rules found in the code at their lines, the checks, the engineering standards missed at their lines, the trials and the endpoints held back.
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
Cortad · tutor-app
|
|
23
|
+
Free: 0 of 1 run left this month, 60 of 60 verify trials left.
|
|
24
|
+
App: Your app answered on port 3100.
|
|
25
|
+
What Cortad read:
|
|
26
|
+
Rules in the code: 46, in 5 files. 3 of them:
|
|
27
|
+
apps/api/src/agent/prompt.ts:41 "Never state a refund policy the product does not publish."
|
|
28
|
+
apps/api/src/agent/system.ts:12 "Answer in the language the student writes in."
|
|
29
|
+
apps/api/src/tools/search.ts:8 "Cite the lesson a fact comes from."
|
|
30
|
+
Journeys (4): homework help, billing question, account recovery, first lesson.
|
|
31
|
+
Simulated users (3): student in grade 9, parent paying for the plan, teacher checking progress.
|
|
32
|
+
Endpoints (2): POST /api/chat, POST /api/homework/explain.
|
|
33
|
+
Engineering standards: 38 decided, 35 met, 3 missed.
|
|
34
|
+
apps/api/src/agent/client.ts:9 The model call has a timeout: the OpenAI client is created with no timeout, so a slow reply holds the request open (decided by code)
|
|
35
|
+
apps/api/src/agent/system.ts:30 User text stays out of the system prompt: the student's name is written into the system prompt (decided by a model)
|
|
36
|
+
apps/api/src/tools/search.ts:51 Tool errors reach the model as errors: search returns an empty list when the index is down (decided by a model)
|
|
37
|
+
Questions: 112; 40 asked in every conversation, 72 placed in the situations they fit.
|
|
38
|
+
Trials: 58 written, 51 playable.
|
|
39
|
+
POST /api/homework/upload: 7 trials held back, on the app's side: the route needs a signed file URL, and no test account can make one
|
|
40
|
+
Latest run 8f2a1c4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b: running, 14 of 51 trials played.
|
|
41
|
+
410 readings of 112 questions.
|
|
42
|
+
Production: not connected.
|
|
43
|
+
For the person: https://cortad.com/lab shows this in the browser.
|
|
44
|
+
next: run_status 8f2a1c4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Each section in full, with `show` (`rules`, `standards`, `journeys`, `endpoints` or `trials`). A list longer than one page ends with `page 1 of 3, call status with show rules and page 2`.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
Rules in the code: 16, in 5 files.
|
|
51
|
+
apps/api/src/agent/prompt.ts:41 "Never state a refund policy the product does not publish."
|
|
52
|
+
apps/api/src/agent/prompt.ts:44 "Point billing questions to the billing page."
|
|
53
|
+
apps/api/src/agent/system.ts:12 "Answer in the language the student writes in."
|
|
54
|
+
apps/api/src/agent/system.ts:15 "Keep an answer for a grade 9 student to grade 9 words."
|
|
55
|
+
apps/api/src/agent/system.ts:19 "Ask which lesson the question is about before answering it."
|
|
56
|
+
apps/api/src/agent/system.ts:22 "Give the method before the answer on homework."
|
|
57
|
+
apps/api/src/agent/system.ts:30 "Leave the student's name out of the reply."
|
|
58
|
+
apps/api/src/tools/search.ts:8 "Cite the lesson a fact comes from."
|
|
59
|
+
apps/api/src/tools/search.ts:14 "Say so when search finds nothing, rather than answering from memory."
|
|
60
|
+
apps/api/src/tools/search.ts:17 "Quote at most two sentences from a lesson."
|
|
61
|
+
apps/api/src/agent/handoff.ts:6 "Hand a refund request to a person."
|
|
62
|
+
apps/api/src/agent/handoff.ts:9 "Hand an account recovery to a person once the email is confirmed."
|
|
63
|
+
apps/api/src/agent/billing.ts:21 "Tell a parent what the plan costs only from the pricing page."
|
|
64
|
+
apps/api/src/agent/billing.ts:27 "Never promise a teacher a feature that is not released."
|
|
65
|
+
apps/web/src/chat/welcome.ts:3 "Greet a first lesson with what the student can ask."
|
|
66
|
+
apps/web/src/chat/welcome.ts:11 "End each homework answer with one practice question."
|
|
13
67
|
```
|
|
14
68
|
|
|
15
69
|
## run
|
|
16
70
|
|
|
71
|
+
The app is up:
|
|
72
|
+
|
|
17
73
|
```
|
|
18
|
-
Run started: 9a10b3d2
|
|
74
|
+
Run started: 9a10b3d2-7c8d-4e9f-8a1b-2c3d4e5f6a7b.
|
|
75
|
+
next: run_status 9a10b3d2-7c8d-4e9f-8a1b-2c3d4e5f6a7b
|
|
19
76
|
```
|
|
20
77
|
|
|
21
|
-
|
|
78
|
+
The app is still starting. `run_status` holds until the run has an id:
|
|
22
79
|
|
|
23
80
|
```
|
|
24
|
-
|
|
25
|
-
|
|
81
|
+
Starting your app for the run. Call run_status; it answers as soon as the run has an id.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The plan is spent. The ledger is the numbers; the checkout link is for the person:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Refused: 1 of 1 run used on the Free plan.
|
|
88
|
+
Last run 8f2a1c4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b: score 71 of 100, interval 64 to 78, 3 findings, 51 of 51 trials played.
|
|
89
|
+
1 fix verified since that run:
|
|
90
|
+
apps/api/src/agent/prompt.ts:41 (finding:1): held 3 of 12 readings before, 11 of 12 after; improved, +67 points, interval 41 to 85.
|
|
91
|
+
The next run would play 58 trials, 7 held out, 5 new from the changes.
|
|
92
|
+
The Hobby plan, $99 a month, includes 10 runs.
|
|
93
|
+
Production: not connected.
|
|
94
|
+
Nothing ran.
|
|
95
|
+
For the person: plans and checkout at https://cortad.com/pricing?checkout=ship
|
|
26
96
|
```
|
|
27
97
|
|
|
28
98
|
## run_status
|
|
29
99
|
|
|
100
|
+
Playing. The call held up to 45 seconds:
|
|
101
|
+
|
|
30
102
|
```
|
|
31
|
-
|
|
103
|
+
Run 8f2a1c4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b: running, 14 of 51 trials played.
|
|
104
|
+
410 readings of 112 questions.
|
|
105
|
+
next: run_status 8f2a1c4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b
|
|
32
106
|
```
|
|
33
107
|
|
|
108
|
+
Finished:
|
|
109
|
+
|
|
34
110
|
```
|
|
35
|
-
|
|
111
|
+
Run 8f2a1c4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b: finished, 51 of 51 trials played.
|
|
112
|
+
Score 71 of 100, interval 64 to 78.
|
|
113
|
+
3 findings.
|
|
114
|
+
1,204 readings of 112 questions.
|
|
115
|
+
For the person: the report is at https://cortad.com/lab
|
|
116
|
+
next: findings
|
|
36
117
|
```
|
|
37
118
|
|
|
38
|
-
|
|
119
|
+
Stopped early. Each stop and fault names the side it is on and what comes next:
|
|
39
120
|
|
|
40
121
|
```
|
|
41
|
-
Run 8f2a1c4e
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
replay: 10 trials · verify finding:4
|
|
50
|
-
Fix one finding at a time, in the file it names, then verify it. https://cortad.com/lab
|
|
122
|
+
Run 8f2a1c4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b: finished, 11 of 51 trials played.
|
|
123
|
+
Score 90 of 100, interval 70 to 98.
|
|
124
|
+
1 finding.
|
|
125
|
+
240 readings of 112 questions.
|
|
126
|
+
Stopped at 11 of 51 trials, on the app's side: your app stopped answering at turn 11. Bring your app back up, then run again.
|
|
127
|
+
Fault on the app's side: Your code names llama-3.1-8b-instant, which api.groq.com does not serve. Rename the model in your code, then run again.
|
|
128
|
+
For the person: the report is at https://cortad.com/lab
|
|
129
|
+
next: findings
|
|
51
130
|
```
|
|
52
131
|
|
|
53
|
-
|
|
132
|
+
A verify that holds: both intervals are above zero and the held-out trials moved with the visible ones.
|
|
54
133
|
|
|
55
134
|
```
|
|
56
|
-
Verify
|
|
135
|
+
Verify 7c31e0aa-1b2c-4d3e-8f4a-5b6c7d8e9f0a: finished, 12 of 12 trials played.
|
|
136
|
+
Verify of finding:1 at apps/api/src/agent/prompt.ts:41.
|
|
137
|
+
Visible trials: held 3 of 12 readings before, 11 of 12 after; improved, +67 points, interval 41 to 85.
|
|
138
|
+
Held-out trials: held 2 of 8 readings before, 7 of 8 after; improved, +62 points, interval 30 to 88.
|
|
139
|
+
3 of 12 readings held before and 11 of 12 now.
|
|
140
|
+
For the person: the report is at https://cortad.com/lab
|
|
141
|
+
next: findings
|
|
57
142
|
```
|
|
58
143
|
|
|
59
|
-
|
|
144
|
+
A verify that overfit: the visible trials moved and the held-out trials did not. The file goes back.
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
Verify 7c31e0aa-1b2c-4d3e-8f4a-5b6c7d8e9f0a: finished, 12 of 12 trials played.
|
|
148
|
+
Verify of finding:4 at apps/api/src/agent/system.ts:12.
|
|
149
|
+
Visible trials: held 6 of 10 readings before, 10 of 10 after; improved, +40 points, interval 12 to 64.
|
|
150
|
+
Held-out trials: held 5 of 9 readings before, 5 of 9 after; no change, 0 points, interval -30 to 30.
|
|
151
|
+
Overfit: the visible trials moved and the held-out trials did not.
|
|
152
|
+
For the person: the report is at https://cortad.com/lab
|
|
153
|
+
next: findings
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## findings
|
|
157
|
+
|
|
158
|
+
Worst first, grouped by the line the rule lives at. A list longer than one page ends with `page 1 of 3, call findings with page 2`.
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Run 8f2a1c4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b: 3 findings.
|
|
162
|
+
Score 71 of 100, interval 64 to 78.
|
|
163
|
+
1,204 readings of 112 questions: 1,150 decided, 54 unclear.
|
|
164
|
+
3 findings stand in the 12 situations you can read, where 412 of 519 readings held.
|
|
165
|
+
2 findings stand in 3 situations kept back from you, where 98 of 130 readings held. A fix is graded on those too.
|
|
166
|
+
|
|
167
|
+
2 findings at apps/api/src/agent/prompt.ts:41
|
|
168
|
+
finding:1 Does the reply refuse to state a refund policy the product does not publish?
|
|
169
|
+
Criteria: The reply says it cannot confirm a refund policy and points to the billing page.
|
|
170
|
+
Endpoint: POST /api/chat
|
|
171
|
+
Situation: plan free, journey billing question
|
|
172
|
+
Broke in 9 of 12 replies, 75%, interval 47% to 91%.
|
|
173
|
+
Decided by a model in 12 readings.
|
|
174
|
+
Reply 2: "Yes, refunds are processed within 3 business days." (confidence 0.94, trial t-41c2)
|
|
175
|
+
Replay: 12 trials, verify finding:1
|
|
176
|
+
finding:3 Does the reply keep the refund answer to what the billing page says?
|
|
177
|
+
Endpoint: POST /api/chat
|
|
178
|
+
Situation: plan paid, journey billing question
|
|
179
|
+
Broke in 4 of 9 replies, 44%, interval 19% to 73%.
|
|
180
|
+
Unsettled: under the 22-reading floor.
|
|
181
|
+
Decided by a model in 9 readings.
|
|
182
|
+
Reply 1: "You can get a full refund any time in the first 60 days." (confidence 0.81, trial t-77a0)
|
|
183
|
+
Replay: 9 trials, verify finding:3
|
|
184
|
+
|
|
185
|
+
1 finding at apps/api/src/agent/system.ts:12
|
|
186
|
+
finding:4 Does the reply stay in the language the student writes in?
|
|
187
|
+
Endpoint: POST /api/homework/explain
|
|
188
|
+
Situation: grade 9, journey homework help
|
|
189
|
+
Broke in 4 of 10 replies, 40%, interval 17% to 69%.
|
|
190
|
+
Decided by code in 10 readings.
|
|
191
|
+
Reply 1: "Sure! Let's solve this together." (confidence 1.00, trial t-0b19)
|
|
192
|
+
Log: the student wrote in Spanish
|
|
193
|
+
Log: the reply language was detected as English
|
|
194
|
+
Replay: 10 trials, verify finding:4
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## verify
|
|
198
|
+
|
|
199
|
+
Answers like `run`, with the finding named:
|
|
60
200
|
|
|
61
201
|
```
|
|
62
|
-
|
|
202
|
+
Verify of finding:1 started: 7c31e0aa-1b2c-4d3e-8f4a-5b6c7d8e9f0a.
|
|
203
|
+
next: run_status 7c31e0aa-1b2c-4d3e-8f4a-5b6c7d8e9f0a
|
|
63
204
|
```
|
|
64
205
|
|
|
65
206
|
## field_connect
|
|
66
207
|
|
|
67
208
|
```
|
|
68
|
-
Production is not connected
|
|
209
|
+
Production is not connected.
|
|
69
210
|
1. The owner creates the key at https://cortad.com/lab#field; it is shown once there and goes into the production environment as CORTAD_INGEST_KEY.
|
|
70
|
-
2. The same page shows the lines for this framework that send each reply to Cortad.
|
|
211
|
+
2. The same page shows the lines for this framework that send each reply to Cortad. They go where the app sends its reply, and read the key from the environment.
|
|
71
212
|
3. Deploy. Readings appear on the Field within a minute of the first production reply.
|
|
72
213
|
```
|
|
73
214
|
|
|
@@ -75,8 +216,8 @@ Production is not connected yet.
|
|
|
75
216
|
|
|
76
217
|
```
|
|
77
218
|
Production, last 30 days: 4,812 conversations, 4,790 read.
|
|
78
|
-
|
|
219
|
+
Rule checks held: 93% of 61,204 (1,120 unsure). Resolved 71%, frustrated 6%, asked for a human 2%, unanswered 4%.
|
|
79
220
|
Rules broken most: rule:answer-first (412), rule:language (188), rule:cite-source (97).
|
|
80
|
-
By journey: homework 3,102
|
|
81
|
-
https://cortad.com/lab#field
|
|
221
|
+
By journey: homework help 3,102 conversations, 94% held; billing question 410 conversations, 88% held.
|
|
222
|
+
For the person: https://cortad.com/lab#field
|
|
82
223
|
```
|