@team-ai/teamai-cli 0.40.8 → 0.50.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/CHANGELOG.md +169 -11
- package/README.ja.md +32 -29
- package/README.ko.md +32 -29
- package/README.md +32 -29
- package/README.th.md +32 -29
- package/README.zh-CN.md +32 -29
- package/agents/README.md +68 -0
- package/agents/README.zh-CN.md +68 -0
- package/agents/teamai-recall.md +10 -9
- package/dist/cli.js +209814 -135972
- package/dist/index.js +291 -0
- package/dist/runtime-paseo.js +27562 -0
- package/dist/runtime-sandbox.js +94740 -0
- package/dist/runtime-t3.js +41891 -0
- package/drivers/teamai-claude.yaml +6 -0
- package/drivers/teamai-codex.yaml +6 -0
- package/drivers/teamai-local.yaml +5 -0
- package/drivers/teamai-opencode.yaml +6 -0
- package/drivers/teamai-paseo.yaml +6 -0
- package/drivers/teamai-sandbox.yaml +7 -0
- package/drivers/teamai-t3.yaml +8 -0
- package/hooks/teamai-env-hint/HOOK.yaml +1 -0
- package/hooks/teamai-env-hint/README.md +80 -0
- package/hooks/teamai-env-hint/README.zh-CN.md +80 -0
- package/hooks/teamai-env-hint/exec.md +1 -0
- package/hooks/teamai-env-hint/secrets-rule.md +1 -0
- package/hooks/teamai-env-hint/secrets.md +1 -0
- package/hooks/teamai-env-hint/variables.md +1 -0
- package/hooks/teamai-friction-reminder/HOOK.yaml +1 -0
- package/hooks/teamai-friction-reminder/README.md +117 -0
- package/hooks/teamai-friction-reminder/README.zh-CN.md +117 -0
- package/hooks/teamai-friction-reminder/action-gap.md +1 -0
- package/hooks/teamai-friction-reminder/action-gap.zh.md +1 -0
- package/hooks/teamai-friction-reminder/action-share-learnings.md +1 -0
- package/hooks/teamai-friction-reminder/action-share-learnings.zh.md +1 -0
- package/hooks/teamai-friction-reminder/action.md +1 -0
- package/hooks/teamai-friction-reminder/action.zh.md +1 -0
- package/hooks/teamai-friction-reminder/gap-reasons.md +1 -0
- package/hooks/teamai-friction-reminder/gap-reasons.zh.md +1 -0
- package/hooks/teamai-friction-reminder/gap.md +1 -0
- package/hooks/teamai-friction-reminder/gap.zh.md +1 -0
- package/hooks/teamai-friction-reminder/params.yaml +12 -0
- package/hooks/teamai-friction-reminder/problem-reasons.md +1 -0
- package/hooks/teamai-friction-reminder/problem-reasons.zh.md +1 -0
- package/hooks/teamai-friction-reminder/problem.md +1 -0
- package/hooks/teamai-friction-reminder/problem.zh.md +1 -0
- package/hooks/teamai-friction-reminder/reason-correction.md +1 -0
- package/hooks/teamai-friction-reminder/reason-correction.zh.md +1 -0
- package/hooks/teamai-friction-reminder/reason-interrupt.md +1 -0
- package/hooks/teamai-friction-reminder/reason-interrupt.zh.md +1 -0
- package/hooks/teamai-friction-reminder/reason-tool-error.md +1 -0
- package/hooks/teamai-friction-reminder/reason-tool-error.zh.md +1 -0
- package/hooks/teamai-friction-reminder/reason-tool-reject.md +1 -0
- package/hooks/teamai-friction-reminder/reason-tool-reject.zh.md +1 -0
- package/hooks/teamai-friction-reminder/task.md +1 -0
- package/hooks/teamai-friction-reminder/task.zh.md +1 -0
- package/hooks/teamai-mr-hint/HOOK.yaml +1 -0
- package/hooks/teamai-mr-hint/README.md +81 -0
- package/hooks/teamai-mr-hint/README.zh-CN.md +81 -0
- package/hooks/teamai-mr-hint/offer-command.en.md +7 -0
- package/hooks/teamai-mr-hint/offer-command.md +10 -0
- package/hooks/teamai-mr-hint/offer-workflow.en.md +7 -0
- package/hooks/teamai-mr-hint/offer-workflow.md +10 -0
- package/hooks/teamai-mr-hint/params.yaml +2 -0
- package/hooks/teamai-package-hint/HOOK.yaml +1 -0
- package/hooks/teamai-package-hint/README.md +64 -0
- package/hooks/teamai-package-hint/README.zh-CN.md +64 -0
- package/hooks/teamai-package-hint/message.md +3 -0
- package/hooks/teamai-todowrite-hint/HOOK.yaml +1 -0
- package/hooks/teamai-todowrite-hint/README.md +68 -0
- package/hooks/teamai-todowrite-hint/README.zh-CN.md +68 -0
- package/hooks/teamai-todowrite-hint/message.en.md +6 -0
- package/hooks/teamai-todowrite-hint/message.md +9 -0
- package/package.json +41 -14
- package/rules/teamai-recall/README.md +78 -0
- package/rules/teamai-recall/README.zh-CN.md +78 -0
- package/rules/teamai-recall/RULE.en.md +36 -0
- package/rules/teamai-recall/RULE.md +43 -0
- package/rules/teamai-recall/block-direct.md +27 -0
- package/rules/teamai-recall/block.en.md +42 -0
- package/rules/teamai-recall/block.md +44 -0
- package/runtimes/teamai-paseo.yaml +5 -0
- package/runtimes/teamai-sandbox.yaml +3 -0
- package/runtimes/teamai-t3.yaml +5 -0
- package/sandboxes/teamai-bwrap.yaml +2 -0
- package/sandboxes/teamai-default.yaml +4 -0
- package/sandboxes/teamai-docker.yaml +5 -0
- package/sandboxes/teamai-podman.yaml +4 -0
- package/sandboxes/teamai-sbx.yaml +4 -0
- package/sandboxes/teamai-seatbelt.yaml +2 -0
- package/sandboxes/teamai-vercel.yaml +4 -0
- package/scorers/README.md +103 -0
- package/scorers/README.zh-CN.md +103 -0
- package/scorers/teamai-adoption.md +11 -0
- package/scorers/teamai-correctness.md +17 -0
- package/scorers/teamai-routing.md +11 -0
- package/skill-data/core/SKILL.md +4 -3
- package/skill-data/core/references/commands.md +300 -67
- package/skill-data/core/references/contribute-member.md +4 -4
- package/skill-data/core/references/troubleshooting.md +128 -18
- package/skill-data/setup/references/join-member.md +13 -9
- package/skill-data/setup/references/manage-admin.md +41 -17
- package/skill-data/setup/references/setup-admin.md +2 -2
- package/skill-data/setup/references/uninstall.md +30 -9
- package/skill-data/share/SKILL.md +17 -12
- package/skill-data/share/references/doc-template.md +3 -4
- package/skill-data/wiki/SKILL.md +1 -1
- package/skill-data/wiki/references/agents/graph-rag-agent.md +5 -1
- package/skill-data/workflow/SKILL.md +39 -16
- package/skill-data/workflow/references/fleet.md +13 -0
- package/skill-data/workflow/references/judging.md +17 -10
- package/skill-data/workflow/references/places.md +64 -7
- package/skill-data/workflow/references/sandbox.md +3 -3
- package/skill-data/workflow/references/session-hosts.md +27 -0
- package/skill-data/workflow-local/SKILL.md +4 -3
- package/skill-data/workflow-local/references/ci.md +1 -1
- package/skills/teamai/SKILL.md +4 -3
- package/workflows/README.md +103 -0
- package/workflows/README.zh-CN.md +103 -0
- package/workflows/teamai-benchmark.yaml +78 -0
- package/workflows/teamai-ci-extract-mr.yaml +66 -0
- package/workflows/teamai-codebase-deep-enrich/README.md +123 -0
- package/workflows/teamai-codebase-deep-enrich/README.zh-CN.md +123 -0
- package/workflows/teamai-codebase-deep-enrich/WORKFLOW.yaml +119 -0
- package/workflows/teamai-codebase-deep-enrich/architecture.md +30 -0
- package/workflows/teamai-codebase-deep-enrich/component.md +30 -0
- package/workflows/teamai-codebase-deep-enrich/params.yaml +1 -0
- package/workflows/teamai-codebase-deep-enrich/scenarios.md +32 -0
- package/workflows/teamai-codebase-enrich.yaml +98 -0
- package/workflows/teamai-draft-learning-updates/README.md +116 -0
- package/workflows/teamai-draft-learning-updates/README.zh-CN.md +116 -0
- package/workflows/teamai-draft-learning-updates/WORKFLOW.yaml +61 -0
- package/workflows/teamai-draft-learning-updates/params.yaml +4 -0
- package/workflows/teamai-finished-sessions/README.md +101 -0
- package/workflows/teamai-finished-sessions/README.zh-CN.md +101 -0
- package/workflows/teamai-finished-sessions/WORKFLOW.yaml +43 -0
- package/workflows/teamai-finished-sessions/params.yaml +1 -0
- package/workflows/teamai-import-from-iwiki.yaml +90 -0
- package/workflows/teamai-import-from-mr/README.md +104 -0
- package/workflows/teamai-import-from-mr/README.zh-CN.md +104 -0
- package/workflows/teamai-import-from-mr/WORKFLOW.yaml +94 -0
- package/workflows/teamai-import-from-mr/draft.en.md +48 -0
- package/workflows/teamai-import-from-mr/draft.zh.md +48 -0
- package/workflows/teamai-import-from-repo/README.md +106 -0
- package/workflows/teamai-import-from-repo/README.zh-CN.md +106 -0
- package/workflows/teamai-import-from-repo/WORKFLOW.yaml +109 -0
- package/workflows/teamai-import-from-repo/narrative.md +83 -0
- package/workflows/teamai-import-learnings.yaml +83 -0
- package/workflows/teamai-import-rules.yaml +34 -0
- package/workflows/teamai-new-scorer.yaml +54 -0
- package/workflows/teamai-promote-learning/README.md +122 -0
- package/workflows/teamai-promote-learning/README.zh-CN.md +122 -0
- package/workflows/teamai-promote-learning/WORKFLOW.yaml +102 -0
- package/workflows/teamai-promote-learning/params.yaml +4 -0
- package/workflows/teamai-score.yaml +121 -0
- package/workflows/teamai-self-improvement.yaml +37 -0
- package/workflows/teamai-session-to-task.yaml +69 -0
- package/workflows/teamai-sessions-to-tasks.yaml +62 -0
- package/workflows/teamai-share-learnings-from-sessions.yaml +36 -0
- package/workflows/teamai-share-learnings.yaml +25 -0
- package/workflows/teamai-share-session.yaml +21 -0
- package/workflows/teamai-try-scorer.yaml +32 -0
- package/skill-data/workflow/references/hosts.md +0 -27
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
schemaVersion: v1alpha1
|
|
2
|
+
name: teamai-new-scorer
|
|
3
|
+
description: Write a new scorer with the person, try it on a finished session and on that session's first prompt alone, storing no label, then propose it to the team as a pull request. Use when the person asks to write, draft or try a scorer or rubric.
|
|
4
|
+
invoke: ask
|
|
5
|
+
# The session the draft is tried on: its id and the tool that holds it, as teamai score --session and --source name them.
|
|
6
|
+
inputs: { session: string, source: string }
|
|
7
|
+
steps:
|
|
8
|
+
- id: draft
|
|
9
|
+
interactive: true
|
|
10
|
+
prompt: |
|
|
11
|
+
Write one scorer with the person: a rubric a judge applies to a finished agent session, such as {{ inputs.source }} session {{ inputs.session }}.
|
|
12
|
+
Ask what good work looks like, and what the judge should read in the session to decide it.
|
|
13
|
+
Write it outside the repository as <name>.md, where <name> is letters, digits, "-" or "_", starting with a letter or digit.
|
|
14
|
+
Its frontmatter has labels, 2 to 20 of { value, score, description }, and passingScore, with at least one label at or above it and one below;
|
|
15
|
+
optional: samplingRate, model, isolation, sessions: true, tool. The text after the frontmatter is the judge's prompt.
|
|
16
|
+
Judge the work, not the request: a rubric that a session where the agent did nothing would pass may not judge the work.
|
|
17
|
+
If the person decides not to write one, return {"verdict":"skip","file":"","name":""}.
|
|
18
|
+
Otherwise return verdict draft, the file's absolute path, and <name>.
|
|
19
|
+
output: { verdict: draft | skip, file: string, name: string }
|
|
20
|
+
- id: check
|
|
21
|
+
needs: [draft]
|
|
22
|
+
if: steps.draft.outputs.verdict == 'draft'
|
|
23
|
+
requires: { host: true }
|
|
24
|
+
command: |
|
|
25
|
+
case "$NAME" in
|
|
26
|
+
''|[!A-Za-z0-9]*|*[!A-Za-z0-9_-]*)
|
|
27
|
+
echo "Scorer name \"$NAME\" is not a scorer file name: use letters, digits, - and _, starting with a letter or digit. Start teamai-new-scorer again and name the scorer that way." >&2
|
|
28
|
+
exit 1 ;;
|
|
29
|
+
esac
|
|
30
|
+
if [ "$(basename "$FILE")" != "$NAME.md" ]; then
|
|
31
|
+
echo "The draft $FILE is not named $NAME.md, and teamai names a scorer after its file. Start teamai-new-scorer again and write it as $NAME.md." >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
env: { FILE: "{{ steps.draft.outputs.file }}", NAME: "{{ steps.draft.outputs.name }}" }
|
|
35
|
+
# The draft judged as teamai pull would cache it, on the session and its control; no label is stored.
|
|
36
|
+
- id: try
|
|
37
|
+
needs: [check]
|
|
38
|
+
if: steps.draft.outputs.verdict == 'draft'
|
|
39
|
+
workflow: teamai-try-scorer
|
|
40
|
+
with: { subject: "session:{{ inputs.source }}:{{ inputs.session }}", files: ["{{ steps.draft.outputs.file }}"] }
|
|
41
|
+
timeout: 30m
|
|
42
|
+
- id: propose
|
|
43
|
+
needs: [draft, try]
|
|
44
|
+
if: steps.draft.outputs.verdict == 'draft'
|
|
45
|
+
approve: |-
|
|
46
|
+
{{ steps.try.outputs.text }}
|
|
47
|
+
|
|
48
|
+
Propose scorers/{{ steps.draft.outputs.name }}.md to the team as a pull request?
|
|
49
|
+
# A scorer name is unique in the team repo. Two members who draft the same scorer share its branch and pull request.
|
|
50
|
+
workspace: { team: { branch: "teamai/new-scorer/{{ steps.draft.outputs.name }}" } }
|
|
51
|
+
deliver: pr
|
|
52
|
+
requires: { host: true }
|
|
53
|
+
command: mkdir -p scorers && cp "$FILE" "scorers/$NAME.md"
|
|
54
|
+
env: { FILE: "{{ steps.draft.outputs.file }}", NAME: "{{ steps.draft.outputs.name }}" }
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# teamai-promote-learning
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Promotes a team learning to a skill, rule or doc. The AI tool picks the category unless the person gave one, and rewrites the learning for it. teamai pushes the result on a review branch with a pull request that says the category and why, then marks the learning promoted.
|
|
6
|
+
|
|
7
|
+
| Started by | |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `teamai recall promote <learning-id>` | `--category` gives the category |
|
|
10
|
+
| An agent session | `invoke: ask`, so an agent starts it once the person agrees |
|
|
11
|
+
|
|
12
|
+
## Which learnings it promotes
|
|
13
|
+
|
|
14
|
+
```mermaid
|
|
15
|
+
flowchart TD
|
|
16
|
+
learning([A learning]) --> conf{Confidence reaches min_confidence?}
|
|
17
|
+
conf -- no --> out([Not a candidate])
|
|
18
|
+
conf -- yes --> up{Upvotes reach min_upvoted?}
|
|
19
|
+
up -- no --> out
|
|
20
|
+
up -- yes --> users{Members who voted reach min_users?}
|
|
21
|
+
users -- no --> out
|
|
22
|
+
users -- yes --> age{"Its date is min_age_days old, or it has none?"}
|
|
23
|
+
age -- no --> out
|
|
24
|
+
age -- yes --> placed{Its promoted_to target is in place?}
|
|
25
|
+
placed -- yes --> out
|
|
26
|
+
placed -- no --> cand([Candidate])
|
|
27
|
+
classDef good fill:#2f8f4f,stroke:#1f6b39,color:#fff;
|
|
28
|
+
classDef skip fill:#6b6b6b,stroke:#4a4a4a,color:#fff;
|
|
29
|
+
class cand good;
|
|
30
|
+
class out skip;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`teamai recall promote` lists the candidates, the `learning` and `publish` steps take only a candidate, and the dashboard's Promote tab shows them. All of them read the same `params.yaml`.
|
|
34
|
+
|
|
35
|
+
## How teamai's version runs
|
|
36
|
+
|
|
37
|
+
```mermaid
|
|
38
|
+
flowchart TD
|
|
39
|
+
learning[Read the candidate] --> given{category given?}
|
|
40
|
+
given -- no --> ask["Ask the AI tool for the category and why"]
|
|
41
|
+
given -- yes --> category
|
|
42
|
+
ask --> category["Settle the category. When the AI could not choose, the keywords' suggestion"]
|
|
43
|
+
category --> content["Ask the AI tool to rewrite the learning for the category"]
|
|
44
|
+
content --> publish["Push it on a review branch with a pull request. When the AI could not rewrite it, the learning as written"]
|
|
45
|
+
publish --> mark(["Mark the learning promoted: exit_code"])
|
|
46
|
+
classDef prompt fill:#6a4f8f,stroke:#513b6d,color:#fff;
|
|
47
|
+
classDef out fill:#2f8f4f,stroke:#1f6b39,color:#fff;
|
|
48
|
+
class ask,content prompt;
|
|
49
|
+
class mark out;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Purple marks a prompt the AI tool answers. An AI tool the member names that cannot run fails the run instead of falling back. `WORKFLOW.yaml` holds the steps.
|
|
53
|
+
|
|
54
|
+
## Files
|
|
55
|
+
|
|
56
|
+
| File | What it is |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `WORKFLOW.yaml` | The steps, and the `output:` each step declares |
|
|
59
|
+
| `params.yaml` | Which learnings can be promoted |
|
|
60
|
+
|
|
61
|
+
## Inputs
|
|
62
|
+
|
|
63
|
+
| Input | Type | Meaning |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| `learning` | `string` | The learning's id, as `teamai recall promote` lists it |
|
|
66
|
+
| `category` | `string` | `skills`, `rules` or `docs`. `''` lets the AI tool pick |
|
|
67
|
+
|
|
68
|
+
## Outputs
|
|
69
|
+
|
|
70
|
+
| Output | Meaning |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `exit_code` | `0` once the learning is marked promoted |
|
|
73
|
+
|
|
74
|
+
## Parameters
|
|
75
|
+
|
|
76
|
+
| Key | Range | What it sets |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `min_confidence` | 0-1 | The confidence a learning needs, from its votes |
|
|
79
|
+
| `min_upvoted` | 1-1000 | The upvotes it needs, from every member together |
|
|
80
|
+
| `min_users` | 1-1000 | The members who must have voted on it |
|
|
81
|
+
| `min_age_days` | 0-3650 | How many days old its `date` must be. A learning with no `date` passes |
|
|
82
|
+
|
|
83
|
+
## Replace it
|
|
84
|
+
|
|
85
|
+
Put only the files you change in `workflows/teamai-promote-learning/` at the root of the team repo. Every other file, `WORKFLOW.yaml` included, stays teamai's and keeps getting teamai's updates. A small team that wants one other member's vote to be enough:
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
# workflows/teamai-promote-learning/params.yaml
|
|
89
|
+
min_users: 1 # the other keys keep teamai's values
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Push the folder. After the next `teamai pull`, the listing, the steps and the dashboard all use it. A key you leave out of `params.yaml` keeps teamai's value from its `params.yaml`.
|
|
93
|
+
|
|
94
|
+
A `WORKFLOW.yaml` of your own in the folder replaces the steps, and `params.yaml` still decides which learnings it takes. A `workflows/teamai-promote-learning.yaml` file replaces the folder whole, so teamai's parameters apply.
|
|
95
|
+
|
|
96
|
+
| Keep | Why |
|
|
97
|
+
|---|---|
|
|
98
|
+
| The inputs and outputs above | `teamai recall promote` passes those inputs and reads that output |
|
|
99
|
+
|
|
100
|
+
## What pull refuses
|
|
101
|
+
|
|
102
|
+
| A team folder that | Pull |
|
|
103
|
+
|---|---|
|
|
104
|
+
| Sets a value out of range, or a key the table above does not list | Names the file and the field. The version pull last took stays in force, teamai's until it took one |
|
|
105
|
+
|
|
106
|
+
`teamai review --branch` fails such a folder before you merge it.
|
|
107
|
+
|
|
108
|
+
## Requires
|
|
109
|
+
|
|
110
|
+
| Needs | Without it |
|
|
111
|
+
|---|---|
|
|
112
|
+
| An AI tool | The keywords' category and the learning as written are used. A tool the member names that cannot run fails the run |
|
|
113
|
+
| Push access to the team's knowledge | The learning stays a candidate, so a later run can promote it |
|
|
114
|
+
|
|
115
|
+
## Settings that change it
|
|
116
|
+
|
|
117
|
+
| Setting | Team `teamai.yaml` | Member config | Environment | Effect |
|
|
118
|
+
|---|---|---|---|---|
|
|
119
|
+
| AI tool | | `workflows.tools.default`, then `ai.tool` | `TEAMAI_AI_TOOL`, before both | Picks the tool that chooses the category and rewrites the learning |
|
|
120
|
+
| Driver | `workflows.driver` | `workflows.driver` | | Picks where the command starts the run. Unset means this machine |
|
|
121
|
+
|
|
122
|
+
The member config is `~/.teamai/projects/<slug>/config.yaml` in a workspace, then `~/.teamai/config.yaml`. The environment wins over the member config, and the member config wins over the team. See [member settings](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/reference.md#member-settings) for the defaults.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# teamai-promote-learning
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
把一条团队经验晋升为 skill、规则或文档。除非成员已经给出类别,否则由 AI 工具选出类别,并按该类别改写这条经验。teamai 把结果推送到一个评审分支,附带说明类别及原因的 pull request,然后把这条经验标记为已晋升。
|
|
6
|
+
|
|
7
|
+
| 启动方式 | |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `teamai recall promote <learning-id>` | `--category` 指定类别 |
|
|
10
|
+
| agent 会话 | `invoke: ask`,所以 agent 在成员同意后才启动它 |
|
|
11
|
+
|
|
12
|
+
## 哪些经验可以晋升
|
|
13
|
+
|
|
14
|
+
```mermaid
|
|
15
|
+
flowchart TD
|
|
16
|
+
learning(["一条经验"]) --> conf{"置信度达到 min_confidence?"}
|
|
17
|
+
conf -- 否 --> out(["不是候选"])
|
|
18
|
+
conf -- 是 --> up{"赞同数达到 min_upvoted?"}
|
|
19
|
+
up -- 否 --> out
|
|
20
|
+
up -- 是 --> users{"投过票的成员数达到 min_users?"}
|
|
21
|
+
users -- 否 --> out
|
|
22
|
+
users -- 是 --> age{"它的 date 已过 min_age_days 天,或没有 date?"}
|
|
23
|
+
age -- 否 --> out
|
|
24
|
+
age -- 是 --> placed{"它的 promoted_to 目标已存在?"}
|
|
25
|
+
placed -- 是 --> out
|
|
26
|
+
placed -- 否 --> cand(["候选"])
|
|
27
|
+
classDef good fill:#2f8f4f,stroke:#1f6b39,color:#fff;
|
|
28
|
+
classDef skip fill:#6b6b6b,stroke:#4a4a4a,color:#fff;
|
|
29
|
+
class cand good;
|
|
30
|
+
class out skip;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`teamai recall promote` 列出候选,`learning` 和 `publish` 两个步骤只接受候选,dashboard 的 Promote 标签页展示它们。它们读的都是同一个 `params.yaml`。
|
|
34
|
+
|
|
35
|
+
## teamai 的版本如何运行
|
|
36
|
+
|
|
37
|
+
```mermaid
|
|
38
|
+
flowchart TD
|
|
39
|
+
learning["读取候选"] --> given{"给出了 category?"}
|
|
40
|
+
given -- 否 --> ask["询问 AI 工具:类别及原因"]
|
|
41
|
+
given -- 是 --> category
|
|
42
|
+
ask --> category["确定类别。AI 选不出时,用关键词建议的类别"]
|
|
43
|
+
category --> content["请 AI 工具按类别改写这条经验"]
|
|
44
|
+
content --> publish["推送到评审分支并开 pull request。AI 改写不了时,按原文发布"]
|
|
45
|
+
publish --> mark(["把经验标记为已晋升:exit_code"])
|
|
46
|
+
classDef prompt fill:#6a4f8f,stroke:#513b6d,color:#fff;
|
|
47
|
+
classDef out fill:#2f8f4f,stroke:#1f6b39,color:#fff;
|
|
48
|
+
class ask,content prompt;
|
|
49
|
+
class mark out;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
紫色表示由 AI 工具回答的提示词。成员指定的 AI 工具无法运行时,运行会失败,而不是退回其他做法。`WORKFLOW.yaml` 保存这些步骤。
|
|
53
|
+
|
|
54
|
+
## 文件
|
|
55
|
+
|
|
56
|
+
| 文件 | 是什么 |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `WORKFLOW.yaml` | 步骤,以及每个步骤声明的 `output:` |
|
|
59
|
+
| `params.yaml` | 哪些经验可以晋升 |
|
|
60
|
+
|
|
61
|
+
## 输入
|
|
62
|
+
|
|
63
|
+
| 输入 | 类型 | 含义 |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| `learning` | `string` | 经验的 id,即 `teamai recall promote` 列出的那个 |
|
|
66
|
+
| `category` | `string` | `skills`、`rules` 或 `docs`。`''` 表示让 AI 工具选 |
|
|
67
|
+
|
|
68
|
+
## 输出
|
|
69
|
+
|
|
70
|
+
| 输出 | 含义 |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `exit_code` | 经验被标记为已晋升后为 `0` |
|
|
73
|
+
|
|
74
|
+
## 参数
|
|
75
|
+
|
|
76
|
+
| 键 | 范围 | 设置什么 |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `min_confidence` | 0-1 | 经验按投票算出的置信度至少要多少 |
|
|
79
|
+
| `min_upvoted` | 1-1000 | 所有成员加起来至少要多少个赞同 |
|
|
80
|
+
| `min_users` | 1-1000 | 至少要多少位成员投过票 |
|
|
81
|
+
| `min_age_days` | 0-3650 | 它的 `date` 至少要过去多少天。没有 `date` 的经验直接通过 |
|
|
82
|
+
|
|
83
|
+
## 替换它
|
|
84
|
+
|
|
85
|
+
在团队仓库根目录的 `workflows/teamai-promote-learning/` 里只放你要改的文件。其他文件(包括 `WORKFLOW.yaml`)仍用 teamai 的,并继续获得 teamai 的更新。小团队希望另一位成员投一票就够:
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
# workflows/teamai-promote-learning/params.yaml
|
|
89
|
+
min_users: 1 # the other keys keep teamai's values
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
推送这个文件夹。下一次 `teamai pull` 之后,列表、步骤和 dashboard 都用它。`params.yaml` 里没写的键,沿用 teamai 的 `params.yaml` 里的值。
|
|
93
|
+
|
|
94
|
+
文件夹里放你自己的 `WORKFLOW.yaml` 会替换步骤,`params.yaml` 仍决定它接受哪些经验。`workflows/teamai-promote-learning.yaml` 单个文件会整体替换这个文件夹,此时用 teamai 的参数。
|
|
95
|
+
|
|
96
|
+
| 保留 | 原因 |
|
|
97
|
+
|---|---|
|
|
98
|
+
| 上面的输入和输出 | `teamai recall promote` 会传这些输入、读这个输出 |
|
|
99
|
+
|
|
100
|
+
## pull 拒绝什么
|
|
101
|
+
|
|
102
|
+
| 团队文件夹 | pull 的处理 |
|
|
103
|
+
|---|---|
|
|
104
|
+
| 设置了超出范围的值,或上表没有列出的键 | 指出文件和字段。pull 上一次接受的版本继续生效,还没接受过时用 teamai 的 |
|
|
105
|
+
|
|
106
|
+
`teamai review --branch` 会在合并前让这样的文件夹不通过。
|
|
107
|
+
|
|
108
|
+
## 依赖
|
|
109
|
+
|
|
110
|
+
| 需要 | 没有时 |
|
|
111
|
+
|---|---|
|
|
112
|
+
| AI 工具 | 用关键词建议的类别,并按原文发布。成员指定的工具无法运行时,运行失败 |
|
|
113
|
+
| 团队知识库的推送权限 | 经验仍是候选,之后的运行可以再晋升它 |
|
|
114
|
+
|
|
115
|
+
## 影响它的设置
|
|
116
|
+
|
|
117
|
+
| 设置 | 团队 `teamai.yaml` | 成员配置 | 环境变量 | 作用 |
|
|
118
|
+
|---|---|---|---|---|
|
|
119
|
+
| AI 工具 | | `workflows.tools.default`,其次是 `ai.tool` | `TEAMAI_AI_TOOL`,优先于两者 | 选出决定类别、改写经验的工具 |
|
|
120
|
+
| 驱动 | `workflows.driver` | `workflows.driver` | | 选出命令在哪里启动运行。未设置表示本机 |
|
|
121
|
+
|
|
122
|
+
成员配置在工作区里是 `~/.teamai/projects/<slug>/config.yaml`,其次是 `~/.teamai/config.yaml`。环境变量优先于成员配置,成员配置优先于团队。默认值见[成员设置](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/zh-CN/reference.md#成员设置)。
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
schemaVersion: v1alpha1
|
|
2
|
+
name: teamai-promote-learning
|
|
3
|
+
description: Promote an adopted, high-confidence learning to a skill, rule or doc - the AI picks the category unless the person gave one, rewrites the learning for it and opens a pull request that says why, then marks it promoted. Use when the person asks to promote a learning that teamai recall promote lists.
|
|
4
|
+
invoke: ask
|
|
5
|
+
private: true
|
|
6
|
+
inputs: { learning: string, category: string }
|
|
7
|
+
ends: { unconfigured-tool: failed }
|
|
8
|
+
defaults:
|
|
9
|
+
requires: { host: true }
|
|
10
|
+
steps:
|
|
11
|
+
- id: learning
|
|
12
|
+
command: teamai recall maintenance promote-candidate --learning "$ID"
|
|
13
|
+
env: { ID: "{{ inputs.learning }}" }
|
|
14
|
+
output: { title: string, content: string, suggested: string }
|
|
15
|
+
- id: ask-category
|
|
16
|
+
needs: [learning]
|
|
17
|
+
if: inputs.category == ''
|
|
18
|
+
answer: |-
|
|
19
|
+
Classify the following team knowledge entry into exactly ONE category, and give the reason in one sentence:
|
|
20
|
+
|
|
21
|
+
- "skills" — reusable workflows, SOPs, step-by-step procedures, CLI recipes, operational playbooks
|
|
22
|
+
- "rules" — mandatory constraints, coding standards, conventions, best practices that MUST be followed
|
|
23
|
+
- "docs" — architecture decisions, system design, background context, reference documentation
|
|
24
|
+
|
|
25
|
+
Title: {{ steps.learning.outputs.title }}
|
|
26
|
+
|
|
27
|
+
Content:
|
|
28
|
+
{{ steps.learning.outputs.content }}
|
|
29
|
+
output: { category: skills | rules | docs, reason: string }
|
|
30
|
+
timeout: 30s
|
|
31
|
+
continue_on_failure: true
|
|
32
|
+
- id: category
|
|
33
|
+
needs: [learning, ask-category]
|
|
34
|
+
# When the AI could not choose, the keywords' suggestion is used, unless it names a tool that cannot run.
|
|
35
|
+
if: steps.ask-category.failure.code != 'tool_unconfigured'
|
|
36
|
+
command: teamai recall maintenance promote-category --given "$GIVEN" --chosen "$CHOSEN" --reason "$REASON" --suggested "$SUGGESTED"
|
|
37
|
+
env:
|
|
38
|
+
GIVEN: "{{ inputs.category }}"
|
|
39
|
+
CHOSEN: "{{ steps.ask-category.outputs.category }}"
|
|
40
|
+
REASON: "{{ steps.ask-category.outputs.reason }}"
|
|
41
|
+
SUGGESTED: "{{ steps.learning.outputs.suggested }}"
|
|
42
|
+
output: { category: string, reason: string }
|
|
43
|
+
- id: content
|
|
44
|
+
needs: [category]
|
|
45
|
+
answer: |-
|
|
46
|
+
You are a technical knowledge engineer promoting a team learning into formal knowledge.
|
|
47
|
+
|
|
48
|
+
The following "learning" has been repeatedly validated by the team (high confidence, adopted by multiple members). Transform it into the {{ steps.category.outputs.category }} form below:
|
|
49
|
+
|
|
50
|
+
- skills: a reusable skill/SOP. Format it with:
|
|
51
|
+
- A clear "when to use" trigger description
|
|
52
|
+
- Step-by-step numbered procedure
|
|
53
|
+
- Expected outcome
|
|
54
|
+
- Common pitfalls to avoid
|
|
55
|
+
Remove any references to specific dates, people, or one-off incidents. Make it timeless and reusable.
|
|
56
|
+
- rules: a team rule/constraint. Format it with:
|
|
57
|
+
- A one-line rule statement (imperative: "Always X" / "Never Y")
|
|
58
|
+
- Rationale: why this matters (1-2 sentences)
|
|
59
|
+
- Examples of correct and incorrect usage
|
|
60
|
+
Remove anecdotal context. State the constraint as an absolute standard.
|
|
61
|
+
- docs: a reference document. Format it with:
|
|
62
|
+
- Context: what system/component this describes
|
|
63
|
+
- Key concepts and their relationships
|
|
64
|
+
- Architecture decisions and their rationale
|
|
65
|
+
- Current state (as of promotion date)
|
|
66
|
+
Remove personal narrative. Write as objective technical documentation.
|
|
67
|
+
|
|
68
|
+
Original learning (title: "{{ steps.learning.outputs.title }}"):
|
|
69
|
+
---
|
|
70
|
+
{{ steps.learning.outputs.content }}
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
Output ONLY the transformed markdown content (including YAML frontmatter with title, tags, date set to today). Do NOT include the original learning's confidence or vote-related fields in the frontmatter.
|
|
74
|
+
output: { text: string }
|
|
75
|
+
timeout: 60s
|
|
76
|
+
continue_on_failure: true
|
|
77
|
+
- id: unconfigured-tool
|
|
78
|
+
needs: [ask-category, content]
|
|
79
|
+
# A tool the member names that cannot run fails the run instead of falling back.
|
|
80
|
+
if: steps.ask-category.failure.code == 'tool_unconfigured' || steps.content.failure.code == 'tool_unconfigured'
|
|
81
|
+
end: unconfigured-tool
|
|
82
|
+
- id: publish
|
|
83
|
+
needs: [content]
|
|
84
|
+
# When the AI could not rewrite it, the learning is published as written, unless it names a tool that cannot run.
|
|
85
|
+
if: steps.content.outcome == 'success' || steps.content.failure.code != 'tool_unconfigured'
|
|
86
|
+
command: teamai recall maintenance promote-publish --learning "$ID" --category "$CATEGORY" --reason "$REASON" --content "$CONTENT" --content-failure "$WHY"
|
|
87
|
+
env:
|
|
88
|
+
ID: "{{ inputs.learning }}"
|
|
89
|
+
CATEGORY: "{{ steps.category.outputs.category }}"
|
|
90
|
+
REASON: "{{ steps.category.outputs.reason }}"
|
|
91
|
+
CONTENT: "{{ steps.content.outputs.text }}"
|
|
92
|
+
WHY: "{{ steps.content.failure.message }}"
|
|
93
|
+
# A project's knowledge lives under .teamai/: the review branch is written there when that checkout is this one.
|
|
94
|
+
writes: [.teamai/]
|
|
95
|
+
output: { target: string, exit_code: number }
|
|
96
|
+
- id: mark
|
|
97
|
+
needs: [publish]
|
|
98
|
+
command: teamai recall maintenance promote-mark --learning "$ID" --published "$PUBLISHED"
|
|
99
|
+
env: { ID: "{{ inputs.learning }}", PUBLISHED: "{{ steps.publish.outputs }}" }
|
|
100
|
+
writes: [.teamai/]
|
|
101
|
+
output: { exit_code: number }
|
|
102
|
+
outputs: { exit_code: steps.mark.outputs.exit_code }
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
schemaVersion: v1alpha1
|
|
2
|
+
name: teamai-score
|
|
3
|
+
description: Label one subject with the scorers that apply to it.
|
|
4
|
+
invoke: deny
|
|
5
|
+
private: true
|
|
6
|
+
# 14 days, the judge-work window. It binds a root run; a workflow that runs this as a step bounds it with that step's timeout.
|
|
7
|
+
timeout: 336h
|
|
8
|
+
inputs:
|
|
9
|
+
# run:<runId>:<step path>:<pass>, session:<source>:<sessionId> or team-session:<author>:<archive name>
|
|
10
|
+
subject: string
|
|
11
|
+
# []: for a pass, the scorers its step pinned; for a session, every scorer with sessions: true
|
|
12
|
+
scorers: [string]
|
|
13
|
+
# '' for none. A hand label skips the stages and the judge, and counts only when a person started the root run.
|
|
14
|
+
label: string
|
|
15
|
+
batch: boolean
|
|
16
|
+
# named: someone asked for this subject, so no sampling, a failed or expired mark reopens, and daily_limit counts it but never refuses it
|
|
17
|
+
demand: auto | named
|
|
18
|
+
# Scorer files to label with in place of scorers, as teamai pull reads them; [] for none. Only with store false.
|
|
19
|
+
files: [string]
|
|
20
|
+
# false: the labels are only tried: no mark opens, and no label, vote or outbox entry is written.
|
|
21
|
+
store: boolean
|
|
22
|
+
# true: judge a session's first prompt alone, the control a tried rubric is compared with.
|
|
23
|
+
control: boolean
|
|
24
|
+
defaults:
|
|
25
|
+
inputs: { files: [], store: true, control: false }
|
|
26
|
+
steps:
|
|
27
|
+
- id: plan
|
|
28
|
+
requires: { host: true }
|
|
29
|
+
command: teamai score plan --subject "$SUBJECT" --scorers "$SCORERS" --batch="$BATCH" --demand "$DEMAND"
|
|
30
|
+
env: { SUBJECT: "{{ inputs.subject }}", SCORERS: "{{ inputs.scorers }}", BATCH: "{{ inputs.batch }}", DEMAND: "{{ inputs.demand }}" }
|
|
31
|
+
output:
|
|
32
|
+
groups: [{ subject: string, hand: string, scorers: string, model: string, ci: boolean, protected: boolean }]
|
|
33
|
+
- id: score
|
|
34
|
+
needs: [plan]
|
|
35
|
+
if: length(steps.plan.outputs.groups) > 0
|
|
36
|
+
for_each: steps.plan.outputs.groups
|
|
37
|
+
continue_on_failure: true
|
|
38
|
+
workflow:
|
|
39
|
+
# written: the version of each label write stored; null when it did not succeed, so the labels were not stored.
|
|
40
|
+
# evidence: the directory that holds the group's labels.json, with the reasoning, while the run's directory lasts.
|
|
41
|
+
# judged: how the judge ended, so a group whose judge was cancelled is said as cancelled, not as a failed step.
|
|
42
|
+
outputs: { labels: steps.label.outputs.labels, written: steps.write.outputs.labels, evidence: steps.evidence.outputs.dir, judged: steps.judge.outcome }
|
|
43
|
+
steps:
|
|
44
|
+
- id: evidence
|
|
45
|
+
requires: { host: true }
|
|
46
|
+
command: teamai score evidence --subject "$SUBJECT" --scorers "$GROUP"
|
|
47
|
+
env: { SUBJECT: "{{ item.subject }}", GROUP: "{{ item.scorers }}" }
|
|
48
|
+
output: { dir: string, rubric: string, schema: string, delivers: boolean }
|
|
49
|
+
- id: check
|
|
50
|
+
needs: [evidence]
|
|
51
|
+
if: item.hand == '' && steps.evidence.outputs.delivers
|
|
52
|
+
requires: { host: true }
|
|
53
|
+
command: teamai score stage check --evidence "$DIR"
|
|
54
|
+
env: { DIR: "{{ steps.evidence.outputs.dir }}" }
|
|
55
|
+
output: { decided: boolean }
|
|
56
|
+
- id: ci
|
|
57
|
+
needs: [evidence, check]
|
|
58
|
+
if: item.hand == '' && item.ci && steps.evidence.outputs.delivers && steps.check.outputs.decided != true
|
|
59
|
+
requires: { host: true }
|
|
60
|
+
# Past 2h of a CI run that has not finished, judge without it.
|
|
61
|
+
command: teamai score stage ci --evidence "$DIR" --wait 2h
|
|
62
|
+
env: { DIR: "{{ steps.evidence.outputs.dir }}" }
|
|
63
|
+
output: { decided: boolean, pending: boolean }
|
|
64
|
+
- id: protected
|
|
65
|
+
needs: [evidence, ci]
|
|
66
|
+
if: item.hand == '' && item.protected && steps.evidence.outputs.delivers && steps.check.outputs.decided != true && steps.ci.outputs.decided != true && steps.ci.outputs.pending != true
|
|
67
|
+
requires: { host: true }
|
|
68
|
+
command: teamai score stage protected --evidence "$DIR"
|
|
69
|
+
env: { DIR: "{{ steps.evidence.outputs.dir }}" }
|
|
70
|
+
output: { decided: boolean }
|
|
71
|
+
- id: judge
|
|
72
|
+
needs: [evidence, protected]
|
|
73
|
+
if: >-
|
|
74
|
+
item.hand == '' && (steps.check.outcome == 'success' || steps.check.outcome == 'skipped') && (steps.ci.outcome == 'success' || steps.ci.outcome == 'skipped') && (steps.protected.outcome == 'success' || steps.protected.outcome == 'skipped')
|
|
75
|
+
&& steps.check.outputs.decided != true && steps.ci.outputs.decided != true && steps.ci.outputs.pending != true && steps.protected.outputs.decided != true
|
|
76
|
+
prompt: |
|
|
77
|
+
Judge one piece of work against a scorer's rubric. Read only the files under {{ steps.evidence.outputs.dir }}:
|
|
78
|
+
the transcript, the diff, and evidence.json with the skills it used.
|
|
79
|
+
|
|
80
|
+
{{ steps.evidence.outputs.rubric }}
|
|
81
|
+
|
|
82
|
+
Reply with that answer under "answer" and nothing else: {"answer": <the answer>}, where the answer matches
|
|
83
|
+
the schema in {{ steps.evidence.outputs.schema }}.
|
|
84
|
+
# Rendered when the step is leased; '' is the tool's default.
|
|
85
|
+
model: "{{ item.model }}"
|
|
86
|
+
# The only readable root. The level comes from confined.json there, which evidence wrote.
|
|
87
|
+
workspace: { confined: "{{ steps.evidence.outputs.dir }}" }
|
|
88
|
+
output: { answer: json }
|
|
89
|
+
- id: label
|
|
90
|
+
needs: [evidence, judge]
|
|
91
|
+
# Reading judge keeps a failed judge from skipping label.
|
|
92
|
+
if: steps.evidence.outcome == 'success' && steps.judge.outcome != 'cancelled'
|
|
93
|
+
requires: { host: true }
|
|
94
|
+
command: teamai score label --evidence "$DIR" --answer "$ANSWER" --judge "$JUDGE"
|
|
95
|
+
env: { DIR: "{{ steps.evidence.outputs.dir }}", ANSWER: "{{ steps.judge.outputs.answer }}", JUDGE: "{{ steps.judge.outcome }}" }
|
|
96
|
+
output: { labels: [{ scorer: string, label: string, code: string }] }
|
|
97
|
+
- id: write
|
|
98
|
+
needs: [label]
|
|
99
|
+
requires: { host: true }
|
|
100
|
+
command: teamai score write --evidence "$DIR"
|
|
101
|
+
env: { DIR: "{{ steps.evidence.outputs.dir }}" }
|
|
102
|
+
output: { written: number, labels: [string] } # labels: the version of each label written, which teamai score answers with
|
|
103
|
+
# Publishes this member's pending labels to teamai-reports. Offline, or with an http team repo, they stay pending.
|
|
104
|
+
# A run that only tries labels publishes nothing.
|
|
105
|
+
- id: publish
|
|
106
|
+
needs: [write]
|
|
107
|
+
if: inputs.store
|
|
108
|
+
workspace: { team: { branch: teamai-reports } }
|
|
109
|
+
requires: { host: true }
|
|
110
|
+
command: teamai score publish
|
|
111
|
+
deliver: publish
|
|
112
|
+
- id: settle
|
|
113
|
+
needs: [evidence, write]
|
|
114
|
+
# After a verb that broke: records the failed attempt. Reading the outcomes keeps it from being skipped.
|
|
115
|
+
if: >-
|
|
116
|
+
!(steps.evidence.outcome == 'success' || steps.evidence.outcome == 'skipped') || !(steps.check.outcome == 'success' || steps.check.outcome == 'skipped') || !(steps.ci.outcome == 'success' || steps.ci.outcome == 'skipped')
|
|
117
|
+
|| !(steps.protected.outcome == 'success' || steps.protected.outcome == 'skipped') || !(steps.label.outcome == 'success' || steps.label.outcome == 'skipped') || !(steps.write.outcome == 'success' || steps.write.outcome == 'skipped')
|
|
118
|
+
requires: { host: true }
|
|
119
|
+
command: teamai score settle --subject "$SUBJECT" --scorers "$GROUP"
|
|
120
|
+
env: { SUBJECT: "{{ item.subject }}", GROUP: "{{ item.scorers }}" }
|
|
121
|
+
outputs: { labels: steps.score.results }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
schemaVersion: v1alpha1
|
|
2
|
+
name: teamai-self-improvement
|
|
3
|
+
description: Improve the team's harness from a scorer's repeated failures - change the resources teamai delivers so that work like the failing one passes, add one regression task per failure, and propose it all as one pull request on the team repo that the next run updates. Its prompt step needs a sandbox.
|
|
4
|
+
invoke: deny
|
|
5
|
+
inputs: { scorer: string, suite: string }
|
|
6
|
+
steps:
|
|
7
|
+
- id: plan
|
|
8
|
+
requires: { host: true }
|
|
9
|
+
command: teamai digest --json --scorer "$SCORER" --suite "$SUITE" --proposal "teamai/self-improvement/$SCORER"
|
|
10
|
+
env: { SCORER: "{{ inputs.scorer }}", SUITE: "{{ inputs.suite }}" }
|
|
11
|
+
output: { data: { improvement: { hasProposal: boolean, failures: [json], covered: [string] } } }
|
|
12
|
+
- id: improve
|
|
13
|
+
needs: [plan]
|
|
14
|
+
# Two failures a task can start from, since one is not a pattern, or one more for a proposal already open.
|
|
15
|
+
if: length(steps.plan.outputs.data.improvement.failures) >= 2 || (length(steps.plan.outputs.data.improvement.failures) >= 1 && steps.plan.outputs.data.improvement.hasProposal)
|
|
16
|
+
workspace: { team: { branch: "teamai/self-improvement/{{ inputs.scorer }}" } }
|
|
17
|
+
deliver: pr
|
|
18
|
+
permissions: unattended
|
|
19
|
+
requires: { isolation: sandbox, strict: true }
|
|
20
|
+
prompt: |
|
|
21
|
+
Improve the team's harness so that the scorer {{ inputs.scorer }} stops failing.
|
|
22
|
+
The current directory holds the team's files, on the open proposal's branch when there is one, with the default branch merged in.
|
|
23
|
+
The scorer's rubric is scorers/{{ inputs.scorer }}.md.
|
|
24
|
+
Failures to fix, newest first: {{ steps.plan.outputs.data.improvement.failures }}
|
|
25
|
+
Regression tasks the team already has for other failures of this scorer, keep them: {{ steps.plan.outputs.data.improvement.covered }}
|
|
26
|
+
Each failure has the label its judge gave, what the work ran as (agent, and the team skills it used), the commit it started at (start.commit),
|
|
27
|
+
and, for a session, the learnings that name it: read each one at its path.
|
|
28
|
+
1. Find what the failures share. Change the team's resources here so that work like this passes the rubric. Any resource teamai delivers may
|
|
29
|
+
change: skills, rules, agents, prompts, hooks, MCP servers, models, env, the team culture (claudemd), docs and workflows.
|
|
30
|
+
Change the scorer only when the failures show its rubric is wrong. Never change application code.
|
|
31
|
+
Change only files in the directories teamai pulls, and add no symlink: a file anywhere else fails the whole proposal.
|
|
32
|
+
2. For each failure, write {{ inputs.suite }}/tasks/<id>.yaml, where <id> is letters, digits, "-" or "_", with:
|
|
33
|
+
schemaVersion v1alpha1; title, what went wrong in a few words; prompt, the request the work was given, as its learnings or its workflow
|
|
34
|
+
step describe it, without the fix; startingCommit, its start.commit; successCriteria, what the rubric's passing label asks of this work,
|
|
35
|
+
in one or two sentences; source, its failure.subject exactly as given.
|
|
36
|
+
3. When the failures share no cause a resource can fix, change nothing: nothing is proposed.
|
|
37
|
+
teamai commits what you change, pushes it to teamai/self-improvement/{{ inputs.scorer }} and opens or updates its pull request.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
schemaVersion: v1alpha1
|
|
2
|
+
name: teamai-session-to-task
|
|
3
|
+
description: Turn the work this session finished, such as a bug fix, a feature or a refactor, into a benchmark task, proposed to the team as a pull request. Use when the person asks to keep this session, fix or change as a benchmark task or add it to a benchmark suite.
|
|
4
|
+
invoke: ask
|
|
5
|
+
inputs:
|
|
6
|
+
session: string
|
|
7
|
+
source: string
|
|
8
|
+
suite: string
|
|
9
|
+
start: string
|
|
10
|
+
solution: string
|
|
11
|
+
# A session a teammate pushed: its name as teamai session list prints it, and who pushed it. "" for a session of this machine.
|
|
12
|
+
team_session: string
|
|
13
|
+
author: string
|
|
14
|
+
defaults:
|
|
15
|
+
requires: { host: true }
|
|
16
|
+
inputs: { team_session: "", author: "" }
|
|
17
|
+
steps:
|
|
18
|
+
- id: draft
|
|
19
|
+
interactive: true
|
|
20
|
+
prompt: |
|
|
21
|
+
Turn the work this {{ inputs.source }} session {{ inputs.session }} finished (a bug fix, a feature, a refactor) into one task of the benchmark suite in {{ inputs.suite }}.
|
|
22
|
+
When the session is not your own, read it first: one of this machine with teamai session show {{ inputs.session }} --source {{ inputs.source }};
|
|
23
|
+
one a teammate pushed, when the pushed name "{{ inputs.team_session }}" is not empty, with
|
|
24
|
+
teamai session show {{ inputs.session }} --team-session "{{ inputs.team_session }}" --author "{{ inputs.author }}" --suite {{ inputs.suite }}.
|
|
25
|
+
Work it with the person. The task starts at commit {{ inputs.start }}; the solution, the commit that completes it, is {{ inputs.solution }} (empty when there is none).
|
|
26
|
+
Write the task file outside the repository, in the format of the files under {{ inputs.suite }}/tasks/:
|
|
27
|
+
schemaVersion v1alpha1; title; prompt, the bug or the request as the person first described it, without the solution;
|
|
28
|
+
startingCommit {{ inputs.start }}; when there is a solution, solutionCommit {{ inputs.solution }}; check, successCriteria, or both;
|
|
29
|
+
and source with platform {{ inputs.source }} and sessionId {{ inputs.session }}.
|
|
30
|
+
check has run, and protect listing every test, config, script and manifest the check reads.
|
|
31
|
+
When there is a solution, check also has add: every file under protect that the solution added or changed and the check reads
|
|
32
|
+
(tests, fixtures, helpers; git diff --name-only {{ inputs.start }} {{ inputs.solution }} lists the candidates), one path each, no globs.
|
|
33
|
+
The trial's agent never sees the add files, so it cannot fit its change to them.
|
|
34
|
+
Every add path must be a file at commit {{ inputs.solution }}; if one is not, tell the person to commit it and start teamai-session-to-task again, and return skip.
|
|
35
|
+
When an add file calls a function, file, option or export that commit {{ inputs.start }} lacks, name it and its signature in prompt,
|
|
36
|
+
so the task can be solved without seeing the test.
|
|
37
|
+
If the person decides the session is not a good task, return {"verdict":"skip","file":"","id":""}.
|
|
38
|
+
Otherwise return verdict draft, the file's path, and the task id as id: letters, digits, "-" or "_", starting with a letter or digit.
|
|
39
|
+
The task is proposed as {{ inputs.suite }}/tasks/<id>.yaml.
|
|
40
|
+
output: { verdict: draft | skip, file: string, id: string }
|
|
41
|
+
- id: check
|
|
42
|
+
needs: [draft]
|
|
43
|
+
if: steps.draft.outputs.verdict == 'draft'
|
|
44
|
+
command: |
|
|
45
|
+
named() { case "$1" in ''|[!A-Za-z0-9]*|*[!A-Za-z0-9_-]*) return 1;; esac; }
|
|
46
|
+
if ! named "$ID"; then
|
|
47
|
+
echo "Task id \"$ID\" is not a task file name: use letters, digits, - and _, starting with a letter or digit. Start teamai-session-to-task again and name the task that way." >&2
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
50
|
+
suite=${SUITE#benchmarks/}
|
|
51
|
+
case "$suite" in
|
|
52
|
+
"$SUITE"|*/*/*) ok=false ;;
|
|
53
|
+
*/*) named "${suite%/*}" && named "${suite#*/}" && ok=true || ok=false ;;
|
|
54
|
+
*) named "$suite" && ok=true || ok=false ;;
|
|
55
|
+
esac
|
|
56
|
+
if [ "$ok" = false ]; then
|
|
57
|
+
echo "Suite \"$SUITE\" is not a suite directory: give benchmarks/<suite> or benchmarks/<namespace>/<suite>, as teamai workflow start --describe teamai-session-to-task proposes." >&2
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
env: { ID: "{{ steps.draft.outputs.id }}", SUITE: "{{ inputs.suite }}" }
|
|
61
|
+
- id: propose
|
|
62
|
+
needs: [check]
|
|
63
|
+
if: steps.draft.outputs.verdict == 'draft'
|
|
64
|
+
approve: Propose {{ inputs.suite }}/tasks/{{ steps.draft.outputs.id }}.yaml to the team as a pull request?
|
|
65
|
+
# A task id is unique only in its suite. Two members who draft the same task share its branch and pull request.
|
|
66
|
+
workspace: { team: { branch: "teamai/session-to-task/{{ inputs.suite }}/{{ steps.draft.outputs.id }}" } }
|
|
67
|
+
deliver: pr
|
|
68
|
+
command: mkdir -p "$(dirname "$TASK_PATH")" && cp "$FILE" "$TASK_PATH"
|
|
69
|
+
env: { FILE: "{{ steps.draft.outputs.file }}", TASK_PATH: "{{ inputs.suite }}/tasks/{{ steps.draft.outputs.id }}.yaml" }
|