AI Agents System Overview
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The AI Agents System in the whk project is a structured framework designed to leverage Artificial Intelligence for automated content management, mathematical problem solving, and editorial review. It provides a suite of specialized "skills" that act as tools for AI agents to interact with the project's Markdown-based knowledge base. These skills enable high-level tasks such as document structure analysis, rigorous layout linting, and advanced mathematical tutoring.
The system is governed by strict workflow protocols, such as the "Plan-then-Execute" model for content integration, ensuring consistency and technical accuracy across the repository. This architecture allows AI agents to function as expert technical writers and subject matter mentors within the高中文化课 (WHK) learning context.
Sources: AGENTS.md:3-5, scripts/workflows/supplement-integration-v2.md:7-14, scripts/skills/math/SKILL.md:5-15
Agent Skill Architecture
The system is divided into functional modules known as "skills." Each skill comprises a set of Node.js scripts and associated Markdown documentation defining its capabilities and usage constraints.
1. Read Skill (Markdown Analysis)
The read skill provides a toolkit for scanning directories and analyzing the structure of Markdown files without loading entire large documents into the AI's context at once.
| Tool | Script | Description |
|---|---|---|
dir_h1 | dir_h1.js | Scans docs/ and outputs the first H1 heading of every file. |
file_headings | file_headings.js | Extracts all Markdown headings with their respective line numbers. |
file_prelimit | file_prelimit.js | Previews the first 1000 non-whitespace characters, skipping YAML frontmatter. |
file_split | file_split.js | Segments large files into 20,000-character chunks for easier processing. |
Sources: AGENTS.md:11-26, scripts/skills/read/SKILL.md:9-95
2. Review Skill (Editorial & Linting)
The review skill acts as an automated editor to ensure all documentation adheres to the project's style guide and technical standards.
- Linting: Uses
node scripts/review/review.js lintto check for formatting errors, reporting results in a.logfile. - Diffing: Uses
node scripts/review/review.js diffto inspect pending changes and identify potential layout regressions before commitment. - Refinement: Agents are instructed to fix typos, grammatical errors, and "low-level" technical mistakes (e.g., formula errors) through deep content understanding.
Sources: AGENTS.md:33-40, REVIEW.md:7-21, scripts/review/SKILL.md:7-17
3. Math Skill (Expert Tutoring)
The math skill transforms the AI agent into a senior high school mathematics/competition mentor. It utilizes a "Deep Chain of Thought" (CoT) and multi-path analysis to solve complex problems.
- Multi-Path Design: Provides a "Standard View" (curriculum-based), "High-Level View" (advanced theorems/shortcuts), and a "Self-Correction" path.
- Precision Control: Employs rigorous verification of algebraic transformations to ensure zero-error output.
- Cognitive Reflection: Concludes solutions with a "Meta-Cognitive Summary" to generalize the problem-solving logic.
Sources: scripts/skills/math/SKILL.md:27-51, scripts/skills/math/SKILL.md:65-74
System Workflows
The AI agents operate under specific operational workflows to manage complexity and maintain context integrity.
Supplement Integration Workflow
This workflow is used to merge content from dev/supplement/ into the main docs/ directory.
The integration process emphasizes organic insertion—fitting new content into existing sections rather than simply appending it, while strictly adhering to the project's typographical rules.
Sources: scripts/workflows/supplement-integration-v2.md:7-14, scripts/workflows/supplement-integration-v2.md:31-104
Mathematical Problem Solving Sequence
When solving math problems, agents follow a structured internal reasoning process.
Sources: scripts/skills/math/SKILL.md:53-74
Technical Standards & Constraints
All agents must adhere to the following rigorous formatting and operational constraints:
Typographical Standards
- Spacing: Mandatory spaces between Chinese characters and English/Numbers (e.g., "对于 $x > 0$").
- Punctuation: Full-width characters for Chinese text; half-width for numbers.
- Formulas: Mandatory empty lines before and after block-level formulas.
- Indentation: Strict 4-space indentation; Tabs are prohibited.
UI Components (Admonitions)
Agents are required to use specific Markdown syntax for highlight blocks (notes, warnings, details):
```md {admonition="note" title="Title"}
Content goes here.
Sources: [AGENTS.md:46-64](https://github.com/raineblog/whk/blob/HEAD/AGENTS.md#L46-L64), [REVIEW.md:37-52](https://github.com/raineblog/whk/blob/HEAD/REVIEW.md#L37-L52), [scripts/skills/math/SKILL.md:76-88](https://github.com/raineblog/whk/blob/HEAD/scripts/skills/math/SKILL.md#L76-L88)
## Summary
The AI Agents System in the `whk` project is a sophisticated environment that balances creative content generation with rigid technical linting. By modularizing capabilities into specialized skills and enforcing multi-stage workflows, the system ensures that AI-generated contributions—whether they are mathematical proofs or documentation updates—meet the high standards of accuracy and readability required for a comprehensive learning repository.
Sources: [scripts/workflows/supplement-integration-v2.md:155-167](https://github.com/raineblog/whk/blob/HEAD/scripts/workflows/supplement-integration-v2.md#L155-L167), [scripts/skills/math/SKILL.md:5-15](https://github.com/raineblog/whk/blob/HEAD/scripts/skills/math/SKILL.md#L5-L15)