Skip to content

Commit 01459dc

Browse files
committed
Update README for for 0.2.0 and add AGENTS.md instructions for AI assistants
1 parent 55131a8 commit 01459dc

2 files changed

Lines changed: 105 additions & 57 deletions

File tree

AGENTS.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
- SKaiNET is a Kotlin Multiplatform Gradle build (see `settings.gradle.kts`) with shared plugin logic in `build-logic/`.
5+
- `skainet-lang/` contains the DSL, operator metadata, and the KSP processor; implementations sit in `src/commonMain`, tests in `src/commonTest`, and generated operator docs in `skainet-lang/skainet-lang-core/build/generated/ksp/metadata/commonMain/resources/operators.json`.
6+
- `skainet-backends/skainet-backend-cpu` implements runtime kernels, `skainet-compile/*` handles graph/HLO/ONNX transforms, `skainet-data/*` provides loaders such as MNIST, and docs plus tooling live in `docs/` and `tools/docgen/`.
7+
8+
## Build, Test, and Development Commands
9+
- `./gradlew clean assemble allTests` mirrors the CI job defined in `.github/workflows/build.yml`; run it before raising a pull request.
10+
- `./gradlew test` or `./gradlew :module:allTests` gives faster feedback for a specific module or target.
11+
- `./gradlew generateDocs validateOperatorSchema` regenerates the reflective AsciiDoc pages and checks the emitted JSON against the schema workflow.
12+
- `./gradlew koverHtmlReport` (or `./gradlew check`) produces coverage reports under `build/reports/kover`.
13+
- `./gradlew apiCheck` blocks unintended ABI drifts; call `apiDump` only when you purposefully evolve a public API.
14+
15+
## Coding Style & Naming Conventions
16+
- Use the Kotlin formatter with 4-space indents and keep files under 120 columns; group related declarations instead of scattering helpers.
17+
- Modules such as `skainet-lang-core` enable `explicitApi`, so spell out visibility and document DSL entry points with concise KDoc for Dokka.
18+
- Favor `UpperCamelCase` types, `lowerCamelCase` members, reserve `snake_case` for fixtures, and suffix backend kernels with `*Kernel`; keep builders pure and gate experiments with `@OptIn`.
19+
20+
## Testing Guidelines
21+
- Locate specs next to code (`skainet-lang/*/src/commonTest`, platform specifics under `src/jvmTest`); name files `FeatureNameTest.kt` and methods `operation_expectedBehavior`.
22+
- Rely on `kotlin-test` and `kotlinx-coroutines-test`; share tensor fixtures through helpers rather than inline literals to stay deterministic.
23+
- Run `./gradlew allTests` before pushing so CI’s build, documentation, and schema-validation workflows reproduce your results, and keep Kover’s reports stable by covering both success and failure paths.
24+
25+
## Commit & Pull Request Guidelines
26+
- Follow GitFlow naming (`feature/<issue>-short-title`, `release/*`, `hotfix/*`) as detailed in `GITFLOW.adoc`.
27+
- Write imperative commit subjects and add trailers such as `Related-To: #123`, matching the current log.
28+
- PRs should summarize the change, list affected modules, mention any doc or API updates, link issues, and confirm the commands above were run locally with evidence (logs, screenshots for DSL/docs).
29+
30+
## Security & Configuration Tips
31+
- Keep credentials in `local.properties` or `~/.gradle/gradle.properties` and never commit data copied from `.github/ci-gradle.properties`.
32+
- Use JDK 17 (see `.java-version`) and avoid manual edits under `docs/modules/operators/_generated_/`; rerun the Gradle doc pipeline instead.

README.md

Lines changed: 73 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,105 @@
1-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
1+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENCE)
22
[![Maven Central](https://img.shields.io/maven-central/v/sk.ainet.core/skainet-lang-core.svg)](https://central.sonatype.com/artifact/sk.ainet.core/skainet-lang-core)
33

44
# SKaiNET
55

6-
**SKaiNET** is an open-source deep learning framework written in Kotlin, designed with developers in mind to enable the creation modern AI powered applications with ease.
6+
**SKaiNET** is an open-source deep learning framework written in Kotlin Mutliplatform, designed with developers in mind to enable the creation modern AI powered applications with ease.
77

8-
## Quick example: training/eval phases with context wrappers
8+
## Use it
99

10-
SKaiNET provides small helper scopes to override the execution phase for a given call without mutating your base context:
10+
- From Kotlin code in apps, libraries, CLIs
11+
- In Kotlin Notebooks for quick exploration
12+
- With sample projects to learn patterns
1113

12-
- train(ctx) { ... } — runs the block with phase = TRAIN
13-
- eval(ctx) { ... } — runs the block with phase = EVAL
14+
See also CHANGELOG for what’s new in 0.2.0.
1415

15-
This is useful for modules that behave differently in training vs evaluation (e.g., Dropout, BatchNorm).
16+
## Quick start
1617

17-
Kotlin
18+
Gradle (Kotlin DSL):
1819

19-
import sk.ainet.context.train
20-
import sk.ainet.context.eval
21-
import sk.ainet.lang.nn.DefaultNeuralNetworkExecutionContext
22-
// import your model class that defines forward(x, ctx)
23-
24-
val base = DefaultNeuralNetworkExecutionContext() // default phase is EVAL
25-
val x = /* prepare your input tensor */
26-
val model = /* construct your model */
27-
28-
// Force TRAIN phase for this call only
29-
val yTrain = train(base) { ctx ->
30-
model.forward(x, ctx)
20+
```kotlin
21+
dependencyResolutionManagement {
22+
repositories {
23+
mavenCentral()
24+
}
3125
}
3226

33-
// Force EVAL phase for this call only
34-
val yEval = eval(base) { ctx ->
35-
model.forward(x, ctx)
27+
dependencies {
28+
// minimal dependency with simple CPU backend
29+
implementation("sk.ainet.core:skainet-lang-core:0.2.0")
30+
implementation("sk.ainet.core:skainet-backend-cpu:0.2.0")
31+
32+
// simple model zoo
33+
implementation("sk.ainet.core:skainet-lang-models:0.2.0")
34+
35+
// Optional I/O (e.g., GGUF loader, JSON)
36+
implementation("sk.ainet.core:skainet-io-core:0.2.0")
37+
implementation("sk.ainet.core:skainet-io-gguf:0.2.0")
3638
}
39+
```
3740

38-
// You can still call with the base context directly (uses its phase)
39-
val yBase = model.forward(x, base)
41+
Maven:
4042

41-
## Development Practices
43+
```xml
44+
<dependency>
45+
<groupId>sk.ainet.core</groupId>
46+
<artifactId>skainet-lang-core</artifactId>
47+
<version>0.2.0</version>
48+
</dependency>
49+
```
4250

43-
This project follows established development practices for maintaining code quality and release management:
51+
## Samples and notebooks
4452

45-
* **Branching Model**: We use [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) as our branching strategy for managing feature development, releases, and hotfixes.
46-
* **Versioning**: We follow [Semantic Versioning (SemVer)](https://semver.org/) for all releases, ensuring predictable version numbering based on the nature of changes.
53+
- Sample app: https://github.com/sk-ai-net/skainet-samples/tree/feature/MNIST/SinusApproximator
54+
- Kotlin Notebook: https://github.com/sk-ai-net/skainet-notebook
4755

48-
## Reflective Documentation (short overview)
4956

50-
SKaiNET includes a reflective documentation system that keeps docs in sync with the code. During the build, a KSP processor extracts operator metadata (signatures, parameters, backend availability, implementation status) into a JSON file. A small DocGen tool then converts this JSON into AsciiDoc fragments and pages.
57+
## 0.2.0 highlights (with tiny snippets)
5158

52-
- Source of truth (generated): skainet-lang/skainet-lang-core/build/generated/ksp/metadata/commonMain/resources/operators.json
53-
- Generated docs output: docs/modules/operators/_generated_/
54-
- Asciidoctor site output: build/docs/asciidoc/ (if you run an Asciidoctor task locally)
59+
- Training/Eval phases made easy
5560

56-
### Quick start: generate reflective docs
61+
```kotlin
62+
val base = DefaultNeuralNetworkExecutionContext() // default = EVAL
63+
val yTrain = train(base) { ctx -> model.forward(x, ctx) }
64+
val yEval = eval(base) { ctx -> model.forward(x, ctx) }
65+
```
5766

58-
Use any of the following Gradle tasks from the project root:
67+
- Dropout and BatchNorm layers
5968

60-
1) Full pipeline (recommended)
61-
./gradlew generateDocs
62-
- Runs KSP to produce operators.json (if needed)
63-
- Generates AsciiDoc files under docs/modules/operators/_generated_
64-
- Optionally, you can run an Asciidoctor task to build an HTML site locally (output under build/docs/asciidoc)
69+
```kotlin
70+
val y = x
71+
.let { dropout(p = 0.1).forward(it, ctx) }
72+
.let { batchNorm(numFeatures = 64).forward(it, ctx) }
73+
```
6574

66-
2) Operators documentation only
67-
./gradlew generateOperatorDocs
68-
- Depends on KSP; runs the built-in generateDocs task and then Asciidoctor
75+
- Conv2D + MaxPool in the NN DSL
76+
77+
```kotlin
78+
val model = nn {
79+
conv2d(outChannels = 16, kernel = 3)
80+
maxPool2d(kernel = 2)
81+
dense(out = 10)
82+
}
83+
```
6984

70-
Open the generated AsciiDoc sources in docs/modules/operators/_generated_ with your preferred AsciiDoc viewer. If you build an HTML site locally with Asciidoctor, open build/docs/asciidoc.
85+
- Data API with MNIST loader and JSON dataset support
7186

72-
### Documentation tooling
87+
```kotlin
88+
val ds = MNIST.load(train = true) // platform-aware loader
89+
val (batchX, batchY) = ds.nextBatch(64)
90+
```
7391

74-
We now use the Gradle plugin (buildSrc) only. The former skainet-lang-export-ops module has been removed. All everyday workflows are covered by:
75-
- generateDocs — converts KSP JSON to AsciiDoc
76-
- validateOperatorSchema — validates generated operators.json against the JSON schema
92+
- GGUF model loading (initial)
7793

78-
Run from the project root, for example:
79-
- ./gradlew generateDocs
80-
- ./gradlew validateOperatorSchema
94+
```kotlin
95+
val gguf = GGUF.read("/path/to/model.gguf")
96+
println("Tensors: ${gguf.tensors.size}")
97+
```
8198

82-
---
99+
- SIMD/Vector API acceleration on JVM; MatMul, tril, pooling ops; forward hooks and simple tape recording; unified tensor creation contexts; nested data blocks returning tensors.
83100

84-
## Development Practices
101+
See CHANGELOG.md for the full list.
85102

86-
This project follows established development practices for maintaining code quality and release management:
103+
## License
87104

88-
* Branching Model: We use GitFlow as our branching strategy for managing feature development, releases, and hotfixes.
89-
* Versioning: We follow Semantic Versioning (SemVer) for all releases, ensuring predictable version numbering based on the nature of changes.
105+
MIT — see LICENSE.

0 commit comments

Comments
 (0)