copilot-session-usage 0.1.0__tar.gz → 0.2.0__tar.gz

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.
Files changed (87) hide show
  1. copilot_session_usage-0.2.0/.github/guidelines/knowledge-base.guidelines.md +86 -0
  2. copilot_session_usage-0.2.0/.github/skills/consolidate-knowledge-base/SKILL.md +68 -0
  3. copilot_session_usage-0.2.0/.github/skills/record-finding/SKILL.md +62 -0
  4. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/.github/workflows/ci.yml +1 -0
  5. copilot_session_usage-0.2.0/.readthedocs.yaml +24 -0
  6. copilot_session_usage-0.2.0/CHANGELOG.md +9 -0
  7. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/PKG-INFO +1 -1
  8. copilot_session_usage-0.2.0/docs/source/changelog.md +4 -0
  9. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/docs/source/index.md +1 -0
  10. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/justfile +7 -3
  11. copilot_session_usage-0.1.0/knowledge/_schema/Concept.schema.yaml → copilot_session_usage-0.2.0/knowledge/_schema/Base.schema.yaml +5 -6
  12. copilot_session_usage-0.2.0/knowledge/_schema/Concept.schema.yaml +20 -0
  13. copilot_session_usage-0.2.0/knowledge/_schema/Experiment.schema.yaml +55 -0
  14. copilot_session_usage-0.2.0/knowledge/_schema/Finding.schema.yaml +64 -0
  15. copilot_session_usage-0.2.0/knowledge/_schema/Playbook.schema.yaml +19 -0
  16. copilot_session_usage-0.2.0/knowledge/_schema/Principle.schema.yaml +40 -0
  17. copilot_session_usage-0.2.0/knowledge/_schema/Reference.schema.yaml +19 -0
  18. copilot_session_usage-0.2.0/knowledge/_schema/Structure.schema.yaml +41 -0
  19. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/concepts/copilot-cli.md +1 -1
  20. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/concepts/index.md +0 -4
  21. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/concepts/overview.md +1 -1
  22. copilot_session_usage-0.2.0/knowledge/experiments/index.md +3 -0
  23. copilot_session_usage-0.2.0/knowledge/experiments/verify-subagent-cost-attribution.md +29 -0
  24. copilot_session_usage-0.2.0/knowledge/findings/index.md +3 -0
  25. copilot_session_usage-0.2.0/knowledge/findings/subagent-logs-use-runsubagent-prefix.md +36 -0
  26. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/guides/automation-scripts.md +2 -2
  27. {copilot_session_usage-0.1.0/knowledge/concepts → copilot_session_usage-0.2.0/knowledge/guides}/cost-optimization.md +2 -2
  28. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/guides/index.md +1 -0
  29. copilot_session_usage-0.2.0/knowledge/index.md +14 -0
  30. copilot_session_usage-0.2.0/knowledge/principles/findings-are-immutable.md +38 -0
  31. copilot_session_usage-0.2.0/knowledge/principles/index.md +3 -0
  32. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/reference/debug-log-format.md +2 -2
  33. copilot_session_usage-0.2.0/knowledge/structures/index.md +6 -0
  34. copilot_session_usage-0.2.0/knowledge/structures/knowledge-base-information-types.md +40 -0
  35. {copilot_session_usage-0.1.0/knowledge/concepts → copilot_session_usage-0.2.0/knowledge/structures}/session-discovery-algorithm.md +1 -1
  36. {copilot_session_usage-0.1.0/knowledge/concepts → copilot_session_usage-0.2.0/knowledge/structures}/subagent-cost-tracking.md +1 -1
  37. {copilot_session_usage-0.1.0/knowledge/concepts → copilot_session_usage-0.2.0/knowledge/structures}/vscode-copilot-extension.md +2 -2
  38. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/pyproject.toml +13 -2
  39. copilot_session_usage-0.2.0/scripts/refresh_pricing.py +9 -0
  40. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/src/copilot_session_usage/_internal/core.py +117 -3
  41. copilot_session_usage-0.2.0/src/copilot_session_usage/data/models-and-pricing.lock +7 -0
  42. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/src/copilot_session_usage/data/models-and-pricing.yml +9 -0
  43. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/tests/test_core.py +23 -0
  44. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/uv.lock +291 -98
  45. copilot_session_usage-0.1.0/.github/guidelines/knowledge-base.guidelines.md +0 -105
  46. copilot_session_usage-0.1.0/knowledge/_schema/Playbook.schema.yaml +0 -27
  47. copilot_session_usage-0.1.0/knowledge/_schema/Reference.schema.yaml +0 -27
  48. copilot_session_usage-0.1.0/knowledge/index.md +0 -10
  49. copilot_session_usage-0.1.0/src/copilot_session_usage/data/models-and-pricing.lock +0 -7
  50. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/.editorconfig +0 -0
  51. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  52. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  53. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/.github/pull_request_template.md +0 -0
  54. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/.github/workflows/publish.yml +0 -0
  55. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/.gitignore +0 -0
  56. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/AGENTS.md +0 -0
  57. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/CONTRIBUTING.md +0 -0
  58. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/LICENSE +0 -0
  59. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/README.md +0 -0
  60. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/docs/source/api.md +0 -0
  61. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/docs/source/cli.md +0 -0
  62. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/docs/source/conf.py +0 -0
  63. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/concepts/session-cost-analysis.md +0 -0
  64. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/concepts/threshold-based-pricing.md +0 -0
  65. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/guides/wsl2-setup.md +0 -0
  66. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/ideas/index.md +0 -0
  67. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/ideas/multi-session-efficiency-analytics.md +0 -0
  68. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/log.md +0 -0
  69. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/reference/index.md +0 -0
  70. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/knowledge/reference/pricing-formats.md +0 -0
  71. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/skills/copilot-session-usage/SKILL.md +0 -0
  72. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/src/copilot_session_usage/__init__.py +0 -0
  73. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/src/copilot_session_usage/_internal/__init__.py +0 -0
  74. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/src/copilot_session_usage/_internal/copilot_cli.py +0 -0
  75. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/src/copilot_session_usage/_internal/vscode.py +0 -0
  76. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/src/copilot_session_usage/api.py +0 -0
  77. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/src/copilot_session_usage/cli.py +0 -0
  78. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/src/copilot_session_usage/data/__init__.py +0 -0
  79. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/src/copilot_session_usage/data/custom-models-pricing.yml +0 -0
  80. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/tests/conftest.py +0 -0
  81. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/tests/test_api.py +0 -0
  82. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/tests/test_cli.py +0 -0
  83. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/tests/test_coverage_gaps.py +0 -0
  84. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/tests/test_rendering.py +0 -0
  85. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/tests/test_vscode.py +0 -0
  86. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/tests/test_vscode_platform.py +0 -0
  87. {copilot_session_usage-0.1.0 → copilot_session_usage-0.2.0}/uv.toml +0 -0
@@ -0,0 +1,86 @@
1
+ ---
2
+ applyTo: "knowledge/**/*.md"
3
+ description: "The minimal rules a coding agent must follow to maintain the OKF knowledge bundle in knowledge/."
4
+ ---
5
+
6
+ # Knowledge Base Maintenance Guidelines
7
+
8
+ `knowledge/` is an [OKF](https://github.com/gsemet/okf-schema) bundle. Each `.md`
9
+ file has a `type` in its frontmatter that maps to a schema in `_schema/`. This
10
+ document is the strict minimal rule set for maintaining it correctly.
11
+
12
+ ## 1. Choose the right type
13
+
14
+ | You want to record… | type | Folder | Nature |
15
+ |---------------------|------|--------|--------|
16
+ | A stable idea / "what is this?" | `Concept` | `concepts/` | Explanatory |
17
+ | How an object is composed / works | `Structure` | `structures/` | Descriptive |
18
+ | A standard or convention (agreed with humans) | `Principle` | `principles/` | Normative |
19
+ | A step-by-step procedure to perform | `Playbook` | `guides/` | Procedural |
20
+ | Exact values, fields, or lookup tables | `Reference` | `reference/` | Lookup |
21
+ | What you observed/believed at time T | `Finding` | `findings/` | Empirical, dated |
22
+ | A reusable procedure to test a claim | `Experiment` | `experiments/` | Template, run 1–2× |
23
+
24
+ Rules of thumb:
25
+
26
+ - Document only what is **non-trivial** for coding agents. Do not paraphrase code
27
+ or existing docs — link instead.
28
+ - Keep each file focused and concise, important information first.
29
+ - Findings and Experiments are the empirical layer; the other five are the stable
30
+ layer. Agents dump Findings freely; stable docs are promoted deliberately by the
31
+ `consolidate-knowledge-base` skill — never dumped ad hoc.
32
+
33
+ ## 2. Required frontmatter
34
+
35
+ All documents (except `index.md` and `log.md`) require:
36
+
37
+ ```yaml
38
+ type: <one of the types above> # must match the const in _schema/<Type>.schema.yaml
39
+ title: Human-Readable Title # non-empty
40
+ description: Short summary. # non-empty
41
+ tags: [keyword] # optional but encouraged
42
+ timestamp: 2026-07-02T00:00:00Z # ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)
43
+ ```
44
+
45
+ Type-specific required fields:
46
+
47
+ - **Finding**: also `timestamp`, `confidence` (`low|medium|high`), and `context`
48
+ (what you believed and the scope you actually tested).
49
+ - **Experiment**: also `hypothesis` and `steps`.
50
+
51
+ ## 3. Finding immutability & contradictions
52
+
53
+ - A Finding's **body and claim are frozen** once written. Never reword or delete.
54
+ - To correct a Finding, write a NEW Finding with `contradicts: [<old-id>]` or
55
+ `supersedes: [<old-id>]`.
56
+ - The only permitted edits to an existing Finding are the lifecycle fields
57
+ `status` (`contradicted|superseded`), `contradicted_by`, `superseded_by`,
58
+ appended by the `consolidate-knowledge-base` review.
59
+ - Promotion of converged Findings into Concept/Structure/Principle is done by
60
+ `consolidate-knowledge-base` with human confirmation — Principles are always
61
+ agreed with humans.
62
+
63
+ ## 4. Skills
64
+
65
+ - **`record-finding`** (fast, non-interactive): dump one Finding after an
66
+ investigation or debugging session.
67
+ - **`consolidate-knowledge-base`** (interactive, human-confirmed): detect
68
+ contradictions, mark findings, propose Experiments, propose promotions.
69
+
70
+ ## 5. Validate before commit
71
+
72
+ ```bash
73
+ just knowledge-lint # auto-format frontmatter + rebuild index
74
+ just knowledge-validate # 0 errors, 0 warnings required
75
+ just knowledge-lint-check # verify no pending format changes
76
+ ```
77
+
78
+ Pre-commit checklist:
79
+
80
+ - [ ] Correct `type` and folder for the information recorded.
81
+ - [ ] Required frontmatter present and valid.
82
+ - [ ] No Finding body was reworded or deleted.
83
+ - [ ] All three commands above pass (also covered by `just preflight`).
84
+
85
+ Add a dated entry to `knowledge/log.md` for significant changes. Use plain
86
+ ISO-8601 date headings; avoid parenthetical annotations (they trigger warnings).
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: consolidate-knowledge-base
3
+ description: 'Interactively review the OKF knowledge base to detect contradictions between Findings, mark contradicted/superseded Findings, propose Experiments to resolve open questions, and propose promotions of converged Findings into stable Concept/Structure/Principle documents. Every mutation is confirmed by a human before it is written. Use periodically or after a batch of recorded Findings.'
4
+ ---
5
+
6
+ # consolidate-knowledge-base
7
+
8
+ Turn a pile of dated Findings into consolidated, trustworthy knowledge — without
9
+ ever rewriting history. This skill is **interactive**: it proposes, the human
10
+ confirms, then it writes.
11
+
12
+ ## When to use
13
+
14
+ - After a batch of Findings has been dumped by `record-finding`.
15
+ - Periodically, to keep the empirical layer coherent with the stable layer.
16
+ - When you suspect two findings disagree.
17
+
18
+ ## Guardrails
19
+
20
+ - NEVER edit or delete a Finding's body. Only append lifecycle frontmatter
21
+ (`status`, `contradicted_by`, `superseded_by`).
22
+ - NEVER promote to a Principle without explicit human confirmation — principles
23
+ are agreed with humans.
24
+ - Ask before every write, using `vscode_askQuestions`.
25
+
26
+ ## Procedure
27
+
28
+ ### 1. Scan
29
+ Read `knowledge/findings/`, plus `principles/`, `structures/`, `concepts/`.
30
+ Build a map of claims, tags, and existing `contradicts`/`supersedes` links.
31
+
32
+ ### 2. Detect contradictions
33
+ Identify pairs where a newer Finding disagrees with an older Finding, or where a
34
+ Finding conflicts with a Principle/Structure/Concept. Present each candidate
35
+ contradiction to the human for confirmation.
36
+
37
+ ### 3. Mark (on confirmation)
38
+ For each confirmed contradiction, append metadata-only fields:
39
+ - On the newer finding: `contradicts: [<old-id>]` (if not already present).
40
+ - On the older finding: `status: contradicted` and `contradicted_by: [<new-id>]`.
41
+ Use the same pattern with `supersedes`/`superseded_by` for replacements.
42
+ The body of both files stays untouched.
43
+
44
+ ### 4. Propose Experiments
45
+ For unresolved or low-confidence contradictions, propose a new `Experiment`
46
+ document (hypothesis, steps, expected_signals, `max_runs: 1–2`) that would
47
+ settle the question. Write it to `knowledge/experiments/` only on confirmation.
48
+
49
+ ### 5. Propose promotions
50
+ When several Findings converge on a stable truth, propose promoting the insight
51
+ into the stable layer:
52
+ - "how it works" → `Structure` in `structures/`
53
+ - "the idea" → `Concept` in `concepts/`
54
+ - "the standard/convention" → `Principle` in `principles/` (always human-agreed)
55
+ Link the promoted doc back to its supporting findings (`supported_by` /
56
+ `related_concepts`). Write only on confirmation. Findings remain untouched.
57
+
58
+ ### 6. Validate
59
+ ```bash
60
+ just knowledge-lint
61
+ just knowledge-validate
62
+ ```
63
+ Both must pass before finishing.
64
+
65
+ ## Output
66
+
67
+ A short chat summary: contradictions found and marked, experiments proposed,
68
+ promotions made, and any open questions left for a future run.
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: record-finding
3
+ description: 'Dump a single empirical Finding into the OKF knowledge base after an investigation or debugging session. Fast and non-interactive. Records what you truthfully observed and believed at this moment, with confidence and context, as an immutable dated note under knowledge/findings/. Use after diagnosing a bug, verifying behavior, or discovering something non-trivial worth remembering.'
4
+ ---
5
+
6
+ # record-finding
7
+
8
+ Record ONE Finding: a dated, empirical, falsifiable note of what you observed and
9
+ believed right now. Findings can later be wrong — that is fine. Be truthful about
10
+ the moment, not about eternal truth.
11
+
12
+ ## When to use
13
+
14
+ - You just finished an investigation, debugging session, or verification.
15
+ - You learned something non-trivial about how the external world (VS Code,
16
+ Copilot, pricing, logs) behaves.
17
+ - You want to hand off "what I found and believed" for later consolidation.
18
+
19
+ Do NOT use this to record standards/conventions (that is a Principle), how an
20
+ object is composed (Structure), or a stable idea (Concept). Those are promoted
21
+ deliberately by `consolidate-knowledge-base`, not dumped.
22
+
23
+ ## Procedure
24
+
25
+ 1. Write exactly one file to `knowledge/findings/<slug>.md` where `<slug>` is a
26
+ short hyphenated summary of the claim.
27
+ 2. Use this frontmatter (all listed fields are required):
28
+
29
+ ```yaml
30
+ ---
31
+ type: Finding
32
+ title: Short claim as a title
33
+ description: One-sentence summary of the finding.
34
+ tags: [relevant, keywords]
35
+ timestamp: <ISO-8601 UTC, e.g. 2026-07-02T14:30:00Z>
36
+ confidence: low | medium | high
37
+ context: >-
38
+ What you believed and the situation at the time — including assumptions
39
+ that may later prove wrong, and the scope you actually tested.
40
+ ---
41
+ ```
42
+
43
+ 3. In the body, state plainly: what was observed, why it matters, and the
44
+ caveats / limits of what you verified.
45
+ 4. If this finding contradicts or replaces an earlier one, add
46
+ `contradicts: [<finding-id>]` or `supersedes: [<finding-id>]`. Do NOT edit the
47
+ older finding — the `consolidate-knowledge-base` skill handles backlinks.
48
+ 5. If a run of an Experiment produced this finding, add `derived_from: <experiment-id>`.
49
+
50
+ ## Immutability
51
+
52
+ Once written, never reword or delete a finding's body. This is enforced by the
53
+ `Findings Are Immutable` principle. Corrections happen by writing a NEW finding.
54
+
55
+ ## Validate
56
+
57
+ ```bash
58
+ just knowledge-lint
59
+ just knowledge-validate
60
+ ```
61
+
62
+ Both must pass. Do not run `consolidate-knowledge-base` here — dumping stays fast.
@@ -43,6 +43,7 @@ jobs:
43
43
  with:
44
44
  files: ./coverage.xml
45
45
  fail_ci_if_error: false
46
+ token: ${{ secrets.CODECOV_TOKEN }}
46
47
 
47
48
  cross-platform:
48
49
  runs-on: ${{ matrix.os }}
@@ -0,0 +1,24 @@
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ version: 2
5
+
6
+ build:
7
+ os: ubuntu-24.04
8
+ tools:
9
+ python: "3.13"
10
+ jobs:
11
+ post_checkout:
12
+ - git fetch --tags
13
+ pre_build:
14
+ - uv run cz changelog
15
+
16
+ sphinx:
17
+ configuration: docs/source/conf.py
18
+
19
+ python:
20
+ install:
21
+ - method: uv
22
+ command: sync
23
+ groups:
24
+ - dev
@@ -0,0 +1,9 @@
1
+ ## Unreleased
2
+
3
+ ### Feat
4
+
5
+ - initial implementation
6
+
7
+ ### Fix
8
+
9
+ - bad cost compuation for Opus 4.8
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: copilot-session-usage
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Usage and cost analytics for GitHub Copilot and Copilot-CLI session logs
5
5
  Project-URL: Homepage, https://github.com/gsemet/copilot-session-usage
6
6
  Project-URL: Documentation, https://copilot-session-usage.readthedocs.io
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ```{include} ../../CHANGELOG.md
4
+ ```
@@ -31,6 +31,7 @@ copilot-session-usage batch 10
31
31
 
32
32
  cli
33
33
  api
34
+ changelog
34
35
  ```
35
36
 
36
37
  ## Indices and tables
@@ -56,8 +56,8 @@ tests-coverage:
56
56
 
57
57
  # ─── Documentation ────────────────────────────────────────────────────────────
58
58
 
59
- # Build Sphinx docs
60
- docs:
59
+ # Build Sphinx docs (regenerates CHANGELOG first)
60
+ docs: changelog
61
61
  uv run -- sphinx-build docs/source docs/_build
62
62
 
63
63
  # Serve docs locally (auto-reload)
@@ -66,13 +66,17 @@ docs-serve:
66
66
 
67
67
  # ─── Build & release ──────────────────────────────────────────────────────────
68
68
 
69
+ # Regenerate CHANGELOG.md from conventional commits
70
+ changelog:
71
+ uv run -- cz changelog
72
+
69
73
  # Build wheel + sdist
70
74
  build:
71
75
  uv build
72
76
 
73
77
  # Refresh bundled pricing data from upstream
74
78
  refresh-pricing:
75
- uv run -- python -c "from copilot_session_usage._internal.core import refresh_pricing; refresh_pricing()"
79
+ uv run -- python scripts/refresh_pricing.py
76
80
 
77
81
  # ─── Knowledge (OKF) ──────────────────────────────────────────────────────────
78
82
 
@@ -1,19 +1,18 @@
1
1
  $schema: "http://json-schema.org/draft-07/schema#"
2
- title: Concept
3
- description: A core concept or explanatory document in the knowledge base.
2
+ title: Base
3
+ description: Common frontmatter fields shared by all knowledge-base documents.
4
4
  type: object
5
5
  required: [type, title, description]
6
6
  properties:
7
7
  type:
8
- description: Document type — must be "Concept" for concept documents.
8
+ description: Document type discriminator.
9
9
  type: string
10
- const: Concept
11
10
  title:
12
- description: Human-readable title of the concept.
11
+ description: Human-readable title of the document.
13
12
  type: string
14
13
  minLength: 1
15
14
  description:
16
- description: Short summary of what the concept explains.
15
+ description: Short summary of what the document covers.
17
16
  type: string
18
17
  minLength: 1
19
18
  tags:
@@ -0,0 +1,20 @@
1
+ $schema: "http://json-schema.org/draft-07/schema#"
2
+ title: Concept
3
+ description: A core concept or explanatory document in the knowledge base.
4
+ allOf:
5
+ - $ref: "Base.schema.yaml"
6
+ - type: object
7
+ properties:
8
+ type:
9
+ description: Document type — must be "Concept" for concept documents.
10
+ type: string
11
+ const: Concept
12
+ related_concepts:
13
+ description: IDs of other Concept documents that deepen or contrast this idea.
14
+ type: array
15
+ items: { type: string }
16
+ prerequisites:
17
+ description: Concepts a reader should understand before engaging with this one.
18
+ type: array
19
+ items: { type: string }
20
+ required: [type]
@@ -0,0 +1,55 @@
1
+ $schema: "http://json-schema.org/draft-07/schema#"
2
+ title: Experiment
3
+ description: >-
4
+ A reusable, prepared procedure that can be executed one or two times to test a
5
+ hypothesis. Each execution produces one Finding. The Experiment is a template;
6
+ its recorded outcomes live as Finding documents.
7
+ type: object
8
+ properties:
9
+ type:
10
+ description: Document type — must be "Experiment".
11
+ type: string
12
+ const: Experiment
13
+ title:
14
+ description: Human-readable title of the experiment.
15
+ type: string
16
+ minLength: 1
17
+ description:
18
+ description: Short summary of what the experiment tests.
19
+ type: string
20
+ minLength: 1
21
+ tags:
22
+ description: Keywords for categorization and search.
23
+ type: array
24
+ items: { type: string }
25
+ timestamp:
26
+ description: When the experiment template was created (ISO 8601).
27
+ type: string
28
+ format: date-time
29
+ hypothesis:
30
+ description: The claim the experiment is designed to confirm or falsify.
31
+ type: string
32
+ minLength: 1
33
+ steps:
34
+ description: Ordered procedure to run the experiment reproducibly.
35
+ type: array
36
+ items: { type: string }
37
+ minItems: 1
38
+ expected_signals:
39
+ description: Observable signals that indicate the hypothesis holds or fails.
40
+ type: array
41
+ items: { type: string }
42
+ max_runs:
43
+ description: How many times this experiment is meant to be run (typically 1–2).
44
+ type: integer
45
+ minimum: 1
46
+ status:
47
+ description: Lifecycle state of the experiment template.
48
+ type: string
49
+ enum: [proposed, active, retired]
50
+ derived_findings:
51
+ description: IDs of Findings produced by running this experiment.
52
+ type: array
53
+ items: { type: string }
54
+ required: [type, title, description, hypothesis, steps]
55
+ additionalProperties: false
@@ -0,0 +1,64 @@
1
+ $schema: "http://json-schema.org/draft-07/schema#"
2
+ title: Finding
3
+ description: >-
4
+ An empirical, dated, falsifiable record of what an agent or human truthfully
5
+ observed and believed at a point in time. The body is immutable once written;
6
+ only lifecycle frontmatter (status, contradicted_by, superseded_by) may be
7
+ appended later.
8
+ type: object
9
+ properties:
10
+ type:
11
+ description: Document type — must be "Finding".
12
+ type: string
13
+ const: Finding
14
+ title:
15
+ description: Human-readable title stating the claim.
16
+ type: string
17
+ minLength: 1
18
+ description:
19
+ description: One-sentence summary of the finding.
20
+ type: string
21
+ minLength: 1
22
+ tags:
23
+ description: Keywords for categorization and search.
24
+ type: array
25
+ items: { type: string }
26
+ timestamp:
27
+ description: When the finding was observed (ISO 8601).
28
+ type: string
29
+ format: date-time
30
+ confidence:
31
+ description: How confident the reporter was at the time of recording.
32
+ type: string
33
+ enum: [low, medium, high]
34
+ context:
35
+ description: >-
36
+ What the reporter believed and the situation at the time — the honest
37
+ basis for the finding, including assumptions that may later prove wrong.
38
+ type: string
39
+ minLength: 1
40
+ status:
41
+ description: Lifecycle state. Appended non-destructively; the body never changes.
42
+ type: string
43
+ enum: [active, contradicted, superseded]
44
+ derived_from:
45
+ description: ID of the Experiment whose run produced this finding, if any.
46
+ type: string
47
+ contradicts:
48
+ description: IDs of earlier Findings this finding contradicts.
49
+ type: array
50
+ items: { type: string }
51
+ supersedes:
52
+ description: IDs of earlier Findings this finding replaces.
53
+ type: array
54
+ items: { type: string }
55
+ contradicted_by:
56
+ description: IDs of later Findings that contradict this one (appended by review).
57
+ type: array
58
+ items: { type: string }
59
+ superseded_by:
60
+ description: IDs of later Findings that replace this one (appended by review).
61
+ type: array
62
+ items: { type: string }
63
+ required: [type, title, description, timestamp, confidence, context]
64
+ additionalProperties: false
@@ -0,0 +1,19 @@
1
+ $schema: "http://json-schema.org/draft-07/schema#"
2
+ title: Playbook
3
+ description: A step-by-step guide, script collection, or actionable workflow.
4
+ allOf:
5
+ - $ref: "Base.schema.yaml"
6
+ - type: object
7
+ properties:
8
+ type:
9
+ description: Document type — must be "Playbook" for playbook documents.
10
+ type: string
11
+ const: Playbook
12
+ estimated_duration:
13
+ description: Approximate time to complete the playbook (e.g., "15 min", "2 h").
14
+ type: string
15
+ tools_required:
16
+ description: CLI tools, scripts, or external utilities the reader must have installed.
17
+ type: array
18
+ items: { type: string }
19
+ required: [type]
@@ -0,0 +1,40 @@
1
+ $schema: "http://json-schema.org/draft-07/schema#"
2
+ title: Principle
3
+ description: >-
4
+ A standard or convention, usually defined with humans. Principles are stable,
5
+ normative statements ("we always…", "never…") — not dated observations. They
6
+ may be supported by Findings but are agreed, not merely observed.
7
+ type: object
8
+ properties:
9
+ type:
10
+ description: Document type — must be "Principle".
11
+ type: string
12
+ const: Principle
13
+ title:
14
+ description: Human-readable title of the principle.
15
+ type: string
16
+ minLength: 1
17
+ description:
18
+ description: Short summary of the standard or convention.
19
+ type: string
20
+ minLength: 1
21
+ tags:
22
+ description: Keywords for categorization and search.
23
+ type: array
24
+ items: { type: string }
25
+ timestamp:
26
+ description: When the principle was agreed or last updated (ISO 8601).
27
+ type: string
28
+ format: date-time
29
+ rationale:
30
+ description: Why this principle exists and what it protects against.
31
+ type: string
32
+ authority:
33
+ description: Who agreed this principle (e.g. "team", "human-reviewed").
34
+ type: string
35
+ supported_by:
36
+ description: IDs of Findings that provide empirical support for this principle.
37
+ type: array
38
+ items: { type: string }
39
+ required: [type, title, description]
40
+ additionalProperties: false
@@ -0,0 +1,19 @@
1
+ $schema: "http://json-schema.org/draft-07/schema#"
2
+ title: Reference
3
+ description: A reference document with structured data, schemas, or lookup tables.
4
+ allOf:
5
+ - $ref: "Base.schema.yaml"
6
+ - type: object
7
+ properties:
8
+ type:
9
+ description: Document type — must be "Reference" for reference documents.
10
+ type: string
11
+ const: Reference
12
+ schema_version:
13
+ description: Version of the data schema or API documented here (e.g., "v2.1").
14
+ type: string
15
+ authoritative_source:
16
+ description: URL or identifier of the canonical upstream specification this reference mirrors.
17
+ type: string
18
+ format: uri
19
+ required: [type]
@@ -0,0 +1,41 @@
1
+ $schema: "http://json-schema.org/draft-07/schema#"
2
+ title: Structure
3
+ description: >-
4
+ A description of how an object, system, or artifact is composed and how its
5
+ parts relate — the "how it works" view. Distinct from a Concept (an idea) and
6
+ from a Playbook (a procedure to perform).
7
+ type: object
8
+ properties:
9
+ type:
10
+ description: Document type — must be "Structure".
11
+ type: string
12
+ const: Structure
13
+ title:
14
+ description: Human-readable title of the structure.
15
+ type: string
16
+ minLength: 1
17
+ description:
18
+ description: Short summary of what is described.
19
+ type: string
20
+ minLength: 1
21
+ tags:
22
+ description: Keywords for categorization and search.
23
+ type: array
24
+ items: { type: string }
25
+ timestamp:
26
+ description: When the structure was documented or last updated (ISO 8601).
27
+ type: string
28
+ format: date-time
29
+ subject:
30
+ description: The object or system whose structure is described.
31
+ type: string
32
+ parts:
33
+ description: The components, fields, or sub-parts that make up the subject.
34
+ type: array
35
+ items: { type: string }
36
+ related_concepts:
37
+ description: IDs of Concept documents that explain the ideas behind this structure.
38
+ type: array
39
+ items: { type: string }
40
+ required: [type, title, description]
41
+ additionalProperties: false
@@ -43,6 +43,6 @@ When asked to extract costs from a Copilot CLI session:
43
43
 
44
44
  ## Related
45
45
 
46
- - [VS Code Copilot Extension](./vscode-copilot-extension.md) — The reference implementation
46
+ - [VS Code Copilot Extension](../structures/vscode-copilot-extension.md) — The reference implementation
47
47
  - [Overview](./overview.md) — General principles that likely apply to both
48
48
  - [Debug Log Format](../reference/debug-log-format.md) — Event structure reference
@@ -1,10 +1,6 @@
1
1
  # concepts
2
2
 
3
3
  - [Copilot CLI Differences](copilot-cli.md) — How session cost tracking differs when using copilot-cli instead of the VS Code extension. [Concept]
4
- - [Cost Optimization Patterns](cost-optimization.md) — Common patterns that inflate session costs and strategies to reduce them. [Playbook]
5
4
  - [Session Cost Analysis](session-cost-analysis.md) — Process of extracting token usage metrics from Copilot debug logs and estimating monetary cost based on per-model pricing. [Concept]
6
5
  - [Session Cost Tracking Overview](overview.md) — How VS Code Copilot tracks and exposes per-session token costs for coding agents. [Concept]
7
- - [Session Discovery Algorithm](session-discovery-algorithm.md) — How an agent resolves a session title, date, or workspace to its debug-log directory via `state.vscdb`. [Concept]
8
- - [Subagent Cost Tracking](subagent-cost-tracking.md) — How subagent costs are logged, aggregated, and correlated with parent sessions. [Concept]
9
6
  - [Threshold-Based Pricing](threshold-based-pricing.md) — How multi-tier model pricing (e.g. GPT-5.4 ≤272K vs >272K) is parsed from YAML and applied during cost estimation. [Concept]
10
- - [VS Code Copilot Extension Debug Logs](vscode-copilot-extension.md) — How the VS Code Copilot extension stores session logs and what agents need to know about path resolution. [Concept]
@@ -44,4 +44,4 @@ Each session directory contains:
44
44
  ## Related
45
45
 
46
46
  - [Debug Log Format](../reference/debug-log-format.md) — Event structure details
47
- - [Subagent Cost Tracking](./subagent-cost-tracking.md) — How subagent costs are aggregated
47
+ - [Subagent Cost Tracking](../structures/subagent-cost-tracking.md) — How subagent costs are aggregated
@@ -0,0 +1,3 @@
1
+ # experiments
2
+
3
+ - [Verify Subagent Cost Attribution](verify-subagent-cost-attribution.md) — Check that subagent token costs are attributed to their runSubagent call and not double-counted in the parent session total. [Experiment]