Skip to content

Commit 7abae8b

Browse files
committed
docs: deepen thin chapters for claude quickstarts, codex analysis, and tiktoken
1 parent ef9c908 commit 7abae8b

8 files changed

Lines changed: 290 additions & 89 deletions

File tree

tutorials/claude-quickstarts-tutorial/04-browser-computer-use.md

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,58 @@ parent: Claude Quickstarts Tutorial
77

88
# Chapter 4: Browser and Computer Use
99

10-
Automation quickstarts demonstrate how Claude can execute browser and desktop actions.
10+
Browser and desktop control quickstarts are high leverage, but they require explicit safety boundaries.
11+
12+
## Execution Loop
13+
14+
A reliable automation loop is:
15+
16+
1. inspect state (DOM snapshot, screenshot, focused window)
17+
2. plan a single concrete action
18+
3. execute action
19+
4. verify resulting state
20+
5. repeat until goal or stop condition
21+
22+
This keeps errors localized and makes debugging straightforward.
1123

1224
## Browser Automation Pattern
1325

14-
- navigate page
15-
- inspect DOM state
16-
- perform targeted interactions
17-
- verify outcome with assertions/screenshots
26+
Use short, verifiable actions:
27+
28+
- navigate to known URL
29+
- wait for explicit selectors
30+
- fill one field at a time
31+
- verify expected text/state before continuing
32+
33+
Avoid monolithic "do everything" instructions that hide failure points.
34+
35+
## Computer-Use Risk Model
36+
37+
Desktop automation should classify actions into risk tiers:
38+
39+
| Tier | Example | Required Control |
40+
|:-----|:--------|:-----------------|
41+
| Low | read visible state | none or lightweight logging |
42+
| Medium | non-destructive clicks/type | confirmation on first use |
43+
| High | file deletion/send/submit | explicit human approval per action |
44+
45+
## Guardrails
1846

19-
## Safety Controls
47+
- strict domain and application allowlists
48+
- denylist destructive shortcuts by default
49+
- short action timeouts with retry limits
50+
- full action log with screenshots for audit
2051

21-
- strict allowlist of domains/actions
22-
- confirmation step for destructive operations
23-
- timeout and retry policies for flaky pages
52+
## Failure Recovery
2453

25-
## Computer Use Notes
54+
When state diverges from expectations:
2655

27-
Computer control workflows are powerful but require strong human-in-the-loop controls for production.
56+
- stop action sequence
57+
- capture current state artifacts
58+
- ask for user confirmation or corrected target
2859

2960
## Summary
3061

31-
You can now apply Claude to UI automation with explicit safety boundaries.
62+
You can now run browser/computer-use workflows with a deterministic control loop and practical safety gates.
3263

3364
Next: [Chapter 5: Autonomous Coding Agents](05-autonomous-coding-agents.md)

tutorials/claude-quickstarts-tutorial/05-autonomous-coding-agents.md

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,56 @@ parent: Claude Quickstarts Tutorial
77

88
# Chapter 5: Autonomous Coding Agents
99

10-
Coding quickstarts show how to combine planning, execution, and persistence across sessions.
10+
Autonomous coding quickstarts work best when planning and execution are separated.
1111

12-
## Two-Agent Pattern
12+
## Two-Agent Baseline
1313

14-
- **Initializer agent**: clarifies goals and constraints.
15-
- **Coding agent**: implements changes and tests them.
14+
- **Planner/Initializer**: clarifies objective, constraints, acceptance criteria
15+
- **Executor/Coder**: performs edits, runs tests, reports concrete outcomes
1616

17-
## Persistence Strategy
17+
This split reduces context confusion and improves handoff quality.
1818

19-
- Store progress in git commits/branches.
20-
- Keep machine-readable task state.
21-
- Resume work from explicit checkpoints.
19+
## Checkpointed Workflow
20+
21+
Use explicit checkpoints after meaningful work units:
22+
23+
1. expected outcome
24+
2. files changed
25+
3. tests run and result
26+
4. unresolved risks
27+
5. next step
28+
29+
Store checkpoints in version control or task state files so runs can resume reliably.
30+
31+
## Autonomous Loop Pattern
32+
33+
```text
34+
plan -> edit -> test -> summarize diff -> checkpoint -> continue or stop
35+
```
36+
37+
Stop conditions should be explicit:
38+
39+
- acceptance criteria met
40+
- blocking test failures
41+
- unsafe/conflicting instructions
2242

2343
## Quality Controls
2444

25-
- run tests before each checkpoint
26-
- require diff summaries
27-
- block merges on failing validations
45+
| Control | Purpose |
46+
|:--------|:--------|
47+
| Required tests per checkpoint | Prevent hidden regressions |
48+
| Diff summary requirement | Improve reviewability |
49+
| Policy checks before merge | Enforce org standards |
50+
| Max iteration budget | Prevent runaway loops |
51+
52+
## Common Failure Modes
53+
54+
- planning omitted, leading to aimless edits
55+
- too many edits before first test run
56+
- missing rollback strategy for failed experiments
2857

2958
## Summary
3059

31-
You can now design persistent coding-agent flows with practical guardrails.
60+
You can now design autonomous coding flows that are resumable, test-driven, and reviewable.
3261

3362
Next: [Chapter 6: Production Patterns](06-production-patterns.md)

tutorials/claude-quickstarts-tutorial/08-enterprise-operations.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,53 @@ parent: Claude Quickstarts Tutorial
77

88
# Chapter 8: Enterprise Operations
99

10-
This chapter closes the quickstarts track with enterprise operations patterns.
10+
This chapter closes the quickstarts path with an enterprise operating model.
1111

12-
## Operations Baseline
12+
## Multi-Tenant Governance Baseline
1313

14-
- per-tenant quotas and usage governance
15-
- centralized prompt/config version management
16-
- incident runbooks for provider degradation
14+
- per-tenant rate and token quotas
15+
- model access policies by environment
16+
- centralized prompt/config versioning
17+
- approval workflows for high-risk tool classes
1718

18-
## Compliance and Auditability
19+
## Auditability Requirements
1920

20-
- trace IDs across request, tool, and response paths
21-
- immutable audit logs for high-risk actions
22-
- retention and redaction policies by environment
21+
Capture immutable run metadata:
22+
23+
- request and trace IDs
24+
- model/version used
25+
- tools invoked and arguments (with redaction)
26+
- policy decisions and approval events
27+
- final outputs and status
28+
29+
Without this, incident response and compliance review become guesswork.
30+
31+
## Reliability and Incident Readiness
32+
33+
- define SLOs for latency and success rate
34+
- maintain runbooks for provider degradation
35+
- implement fallback behavior for critical workflows
36+
- test rollback paths during release drills
37+
38+
## Security and Data Handling
39+
40+
| Area | Enterprise Control |
41+
|:-----|:-------------------|
42+
| Secrets | centralized secret management, no inline keys |
43+
| Data retention | environment-specific retention windows |
44+
| PII handling | classification + redaction policy |
45+
| Access control | least privilege by role/team |
46+
47+
## Adoption Playbook
48+
49+
1. launch read-only assistant capabilities first
50+
2. baseline quality/cost metrics
51+
3. introduce mutating actions with approvals
52+
4. expand scope by team with policy templates
2353

2454
## Final Summary
2555

26-
You now have an end-to-end path from prototype quickstarts to enterprise-grade Claude systems.
56+
You now have a practical blueprint for scaling Claude quickstarts into governed enterprise operations.
2757

2858
Related:
2959
- [Anthropic Skills Tutorial](../anthropic-skills-tutorial/)

tutorials/codex-analysis-platform/07-automation-pipelines.md

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,47 @@ nav_order: 7
77

88
# Chapter 7: Automation Pipelines
99

10-
This chapter covers integrating analysis outputs into automated engineering pipelines.
10+
This chapter covers operationalizing analysis outputs inside CI/CD and scheduled workflows.
1111

12-
## Pipeline Integrations
12+
## Pipeline Integration Layers
1313

14-
- CI checks for static analysis regressions
15-
- nightly repository-wide indexing refresh jobs
16-
- pull-request annotations with symbol-impact summaries
14+
1. **Pull Request checks**: fail on new high-severity analysis findings
15+
2. **Nightly index refresh**: rebuild code graph and dependency metadata
16+
3. **Report publishing**: generate trend dashboards and team-level summaries
1717

18-
## Reliability Patterns
18+
## PR Workflow Pattern
1919

20-
- checkpoint incremental state between runs
21-
- retry transient parser/index failures with backoff
22-
- isolate language workers to prevent cross-language contention
20+
```text
21+
new PR -> scoped analysis -> annotate changed files -> enforce policy thresholds
22+
```
2323

24-
## Data Products
24+
Use changed-file scoping for fast feedback and reserve full-repo scans for scheduled jobs.
2525

26-
- architecture drift reports
27-
- dependency risk dashboards
28-
- trend metrics for complexity and ownership
26+
## Reliability Controls
27+
28+
- checkpoint index state between runs
29+
- retry transient parser/network failures with backoff
30+
- isolate language workers to prevent cross-language failures
31+
- time-box expensive graph traversals
32+
33+
## Data Products for Engineering Leadership
34+
35+
- architecture drift alerts
36+
- ownership hotspot reports
37+
- dependency risk trendlines
38+
- complexity deltas by repository area
39+
40+
## Operational Metrics
41+
42+
| Metric | Why It Matters |
43+
|:-------|:---------------|
44+
| analysis duration | CI throughput and developer UX |
45+
| stale-index ratio | data freshness confidence |
46+
| parser failure rate | source-coverage reliability |
47+
| policy violation trend | risk posture over time |
2948

3049
## Summary
3150

32-
You can now operationalize analysis artifacts in continuous engineering workflows.
51+
You can now embed code analysis into continuous delivery with measurable reliability.
3352

3453
Next: [Chapter 8: Production Rollout](08-production-rollout.md)

tutorials/codex-analysis-platform/08-production-rollout.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,50 @@ nav_order: 8
77

88
# Chapter 8: Production Rollout
99

10-
This chapter finalizes the platform with production rollout, governance, and scaling strategy.
10+
This chapter finalizes rollout strategy, governance, and long-term operations.
1111

12-
## Rollout Plan
12+
## Rollout Phasing
1313

14-
- phase by repository size and team adoption risk
15-
- start with read-only insights before enforcement
16-
- add policy gates only after baseline stabilization
14+
Start with low-risk adoption:
1715

18-
## Platform Operations
16+
1. read-only insights and dashboards
17+
2. non-blocking PR annotations
18+
3. soft policy thresholds with override process
19+
4. hard enforcement after baseline stabilization
1920

20-
- monitor analysis latency and queue depth
21-
- track stale index percentage
22-
- alert on parser/version incompatibilities
21+
## Governance Model
22+
23+
- define policy owners per rule class
24+
- separate policy authoring from enforcement runtime
25+
- version policy bundles with change approval
26+
- maintain documented exception process
27+
28+
## Capacity and Scaling
29+
30+
- shard analysis queues by repository and language
31+
- isolate heavy graph jobs from latency-sensitive PR checks
32+
- precompute frequently requested dependency paths
33+
34+
## Incident Response Playbook
35+
36+
Prepare for:
37+
38+
- parser version regressions
39+
- stale or corrupt index snapshots
40+
- policy misconfiguration causing false positives
41+
- provider/toolchain outages
42+
43+
Each failure mode needs rollback and communication steps.
44+
45+
## Final Success Criteria
46+
47+
- <target> CI latency overhead accepted by teams
48+
- stable policy precision/recall for key risk classes
49+
- clear ownership for platform and policy operations
2350

2451
## Final Summary
2552

26-
You now have complete coverage for building, integrating, and operating a code intelligence platform.
53+
You now have an operational rollout framework for sustained code-intelligence platform adoption.
2754

2855
Related:
2956
- [Language Server Protocol](https://microsoft.github.io/language-server-protocol/)

tutorials/tiktoken-tutorial/06-chatml-and-tool-calls.md

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,48 @@ parent: tiktoken Tutorial
77

88
# Chapter 6: ChatML and Tool Call Accounting
99

10-
This chapter covers reliable token accounting for chat messages and tool-call payloads.
10+
Accurate token accounting for chat and tools is essential for reliability and cost predictability.
1111

12-
## Message Accounting Pattern
12+
## Where Underestimation Happens
1313

14-
- count tokens per message role (`system`, `user`, `assistant`)
15-
- include hidden scaffolding overhead in estimates
16-
- budget separately for tool arguments and tool results
14+
Teams often count only user-visible text and miss:
1715

18-
## Practical Rule
16+
- role/message wrapper overhead
17+
- tool schema tokens
18+
- serialized tool arguments/results
19+
- retry-induced duplicate token spend
1920

20-
Always estimate using the exact model encoding and message format you will send.
21+
## Accounting Strategy
2122

22-
## Example
23+
1. tokenize each message with the exact target encoding
24+
2. add fixed wrapper overhead expected by your request format
25+
3. account for tool payloads separately
26+
4. include response-token guardband for retries/replans
27+
28+
## Example Helper
2329

2430
```python
25-
def estimate_chat_tokens(messages, enc):
26-
return sum(len(enc.encode(m["content"])) for m in messages)
31+
def estimate_chat_tokens(messages, encoding, fixed_overhead=0):
32+
total = fixed_overhead
33+
for m in messages:
34+
total += len(encoding.encode(m.get("content", "")))
35+
return total
2736
```
2837

38+
For tool flows, create separate counters for:
39+
40+
- tool call request payload
41+
- tool response payload
42+
- assistant synthesis after tool result
43+
44+
## Operational Use
45+
46+
- preflight estimate before API call
47+
- reject or compress if over budget
48+
- log estimate vs actual for calibration
49+
2950
## Summary
3051

31-
You can now avoid underestimating token cost in chat-tool workflows.
52+
You can now estimate chat/tool token usage with fewer hidden-cost surprises.
3253

3354
Next: [Chapter 7: Multilingual Tokenization](07-multilingual-tokenization.md)

0 commit comments

Comments
 (0)