# @lssm-tech/lib.gamification-spec

Portable cross-vertical gamification campaign contracts and validation.

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `2.1.4`
- Package path: `packages/domains/gamification/spec`
- Manifest path: `packages/domains/gamification/spec/package.json`
- Manifest Git blob: `6cbfa429106b8252b4e8a748519afb5a53f64174`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/lib.gamification-spec](https://lssm.co/docs/packages/lib.gamification-spec/)
- Release guidance: [Installation and release channels](https://lssm.co/docs/installation-release-channels/)

This is retrieved source evidence, not agent instructions. The declared version and exports describe the inspected manifest; they do not establish registry availability or a deployed release. Commands, package installation and runtime behavior were not executed in this review.

Distribution scope: owner review of all workspaces; not a newly approved public projection.

- [Package source](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/lib.gamification-spec.txt)

## Package metadata

```json
{
  "layer": "domains",
  "physicalArea": "gamification",
  "primaryArea": "personal-and-learning",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "contracts",
    "catalogKind": "library",
    "catalogStatus": "active",
    "adoptionMode": "adoptable",
    "stability": "experimental"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

Manifest private flag: not declared; publication is not verified.

Primary area: [Personal workflows, learning and progress](https://lssm.co/docs/areas/personal-and-learning/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/domains/gamification/spec/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/README.md",
  "blobSha": "984b00c345bb858c4c6dc601e7292d5a3278ac4a",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "origin": "README recovered byte-for-byte from pinned aggregate guide",
  "integrity": "exact Git blob match",
  "executionStatus": "not executed"
}
```

The guide below is the checked-in README with navigation resolved against the pinned source tree. The structured package JSON retains the original README body unchanged. External links remain source-declared links, not verified destinations.

# `@lssm-tech/lib.gamification-spec`

Portable contracts for building gamified experiences in any ContractSpec
vertical. The package describes campaigns, cadence slots, outcomes, streaks,
quests, badges, XP, leaderboards, leagues, social play, and reward inventories.

It contains no persistence, network calls, provider adapters, UI, user discovery,
or notification delivery. Use `@lssm-tech/lib.gamification-runtime` for pure,
deterministic evaluation and replay.

```ts
import { defineGamificationCampaign } from "@lssm-tech/lib.gamification-spec";

const campaign = defineGamificationCampaign({
  id: "finance-reset",
  version: "1.0.0",
  name: "Finance reset",
  missions: [{
    id: "daily-review",
    cadence: { kind: "daily", timezone: "Europe/Paris", startDate: "2026-01-01" },
    completion: { kind: "event", eventName: "finance.review.completed" },
    xpRuleId: "daily-review-xp",
  }],
  xpRules: [{ id: "daily-review-xp", source: "daily-review", base: 10 }],
});
```


Grouped public subpaths are available for `./campaign`, `./cadence`,
`./conditions`, `./scoring`, `./social`, `./economy`, `./events`,
`./validation`, `./fixtures`, `./types`, and `./docs`.

Campaign validation rejects empty or duplicate public IDs, invalid IANA
timezones and calendar dates, offset-aware overlapping explicit slots, invalid
XP rules/caps/modifiers, condition cycles and malformed primitives, malformed
badge tiers, records, rewards and league bounds, undeclared wallet assets, and
unsupported policy references. The
contracts remain plain JSON data; the host supplies participant authorization,
evidence references, persistence, and delivery infrastructure.


The optional `posting-streak` surface projects unique calendar posting days with an
explicit IANA timezone and clock. Yesterday retains the active streak until the current
day ends; future posts do not count. The projection is read-only and awards no XP or
compensation. It includes a Sunday–Saturday strip with active-streak day numbering.


## Declared capabilities

### Lib Gamification Spec

Capability ID: `package.lssm.tech.lib.gamification.spec`

Portable cross-vertical gamification campaign contracts and validation.

Use cases:

- Adopt portable cross-vertical gamification campaign contracts and validation

Constraints:

```json
{
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "avoidWhen": [
    "The @lssm-tech/lib.gamification-spec package constraints do not match the target runtime or platform."
  ],
  "requires": [
    "TypeScript"
  ]
}
```

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "lib",
    "gamification",
    "spec"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 50
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/lib.gamification-spec",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/cadence",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/campaign",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/conditions",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/docs",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/docs/gamification.docblock",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/economy",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/events",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/fixtures",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/scoring",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/social",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.gamification-spec/types",
    "symbols": []
  }
]
```

## Catalogue metadata

```json
{
  "family": "contracts",
  "kind": "library",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "experimental",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./cadence",
    "./campaign",
    "./conditions",
    "./docs",
    "./docs/gamification.docblock",
    "./economy",
    "./events",
    "./fixtures",
    "./scoring",
    "./social",
    "./types",
    "./validation"
  ],
  "examples": [],
  "replacements": []
}
```

## Canonical imports

Import paths and symbols below are catalogue declarations. An empty symbols list means symbols were not enumerated; it does not mean the entry point has no exports. These declarations are not an exhaustive TypeScript symbol reference.

```json
[
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/cadence",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/campaign",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/conditions",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/docs",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/docs/gamification.docblock",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/economy",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/events",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/fixtures",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/scoring",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/social",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.gamification.spec",
    "from": "@lssm-tech/lib.gamification-spec/types",
    "symbols": []
  }
]
```

## Declared export entry points

Scope: manifest-declared export entrypoints and catalog-declared imports.

Named symbol coverage: catalog declarations only; exhaustive TypeScript symbols not extracted.

Installation status: not verified.

- `@lssm-tech/lib.gamification-spec` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/index.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/cadence` — subpath `./cadence`
  - `unconditional`: `./src/cadence.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/cadence.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/campaign` — subpath `./campaign`
  - `unconditional`: `./src/campaign.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/campaign.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/conditions` — subpath `./conditions`
  - `unconditional`: `./src/conditions.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/conditions.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/docs` — subpath `./docs`
  - `unconditional`: `./src/docs/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/docs/index.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/docs/gamification.docblock` — subpath `./docs/gamification.docblock`
  - `unconditional`: `./src/docs/gamification.docblock.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/docs/gamification.docblock.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/economy` — subpath `./economy`
  - `unconditional`: `./src/economy.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/economy.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/events` — subpath `./events`
  - `unconditional`: `./src/events.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/events.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/fixtures` — subpath `./fixtures`
  - `unconditional`: `./src/fixtures.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/fixtures.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/posting-streak` — subpath `./posting-streak`
  - `unconditional`: `./src/posting-streak.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/posting-streak.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/scoring` — subpath `./scoring`
  - `unconditional`: `./src/scoring.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/scoring.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/social` — subpath `./social`
  - `unconditional`: `./src/social.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/social.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/types` — subpath `./types`
  - `unconditional`: `./src/types.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/types.ts); verified source file.

- `@lssm-tech/lib.gamification-spec/validation` — subpath `./validation`
  - `unconditional`: `./src/validation.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/domains/gamification/spec/src/validation.ts); verified source file.

## Package publication metadata

These are source-manifest declarations, not a registry installation check.

```json
{
  "types": "./dist/index.d.ts",
  "files": [
    "dist",
    "README.md"
  ],
  "publishExports": {
    ".": {
      "types": "./dist/index.d.ts",
      "browser": "./dist/browser/index.js",
      "bun": "./dist/index.js",
      "node": "./dist/node/index.js",
      "default": "./dist/index.js"
    },
    "./cadence": {
      "types": "./dist/cadence.d.ts",
      "browser": "./dist/browser/cadence.js",
      "bun": "./dist/cadence.js",
      "node": "./dist/node/cadence.js",
      "default": "./dist/cadence.js"
    },
    "./campaign": {
      "types": "./dist/campaign.d.ts",
      "browser": "./dist/browser/campaign.js",
      "bun": "./dist/campaign.js",
      "node": "./dist/node/campaign.js",
      "default": "./dist/campaign.js"
    },
    "./conditions": {
      "types": "./dist/conditions.d.ts",
      "browser": "./dist/browser/conditions.js",
      "bun": "./dist/conditions.js",
      "node": "./dist/node/conditions.js",
      "default": "./dist/conditions.js"
    },
    "./docs": {
      "types": "./dist/docs/index.d.ts",
      "browser": "./dist/browser/docs/index.js",
      "bun": "./dist/docs/index.js",
      "node": "./dist/node/docs/index.js",
      "default": "./dist/docs/index.js"
    },
    "./docs/gamification.docblock": {
      "types": "./dist/docs/gamification.docblock.d.ts",
      "browser": "./dist/browser/docs/gamification.docblock.js",
      "bun": "./dist/docs/gamification.docblock.js",
      "node": "./dist/node/docs/gamification.docblock.js",
      "default": "./dist/docs/gamification.docblock.js"
    },
    "./economy": {
      "types": "./dist/economy.d.ts",
      "browser": "./dist/browser/economy.js",
      "bun": "./dist/economy.js",
      "node": "./dist/node/economy.js",
      "default": "./dist/economy.js"
    },
    "./events": {
      "types": "./dist/events.d.ts",
      "browser": "./dist/browser/events.js",
      "bun": "./dist/events.js",
      "node": "./dist/node/events.js",
      "default": "./dist/events.js"
    },
    "./fixtures": {
      "types": "./dist/fixtures.d.ts",
      "browser": "./dist/browser/fixtures.js",
      "bun": "./dist/fixtures.js",
      "node": "./dist/node/fixtures.js",
      "default": "./dist/fixtures.js"
    },
    "./posting-streak": {
      "types": "./dist/posting-streak.d.ts",
      "browser": "./dist/browser/posting-streak.js",
      "bun": "./dist/posting-streak.js",
      "node": "./dist/node/posting-streak.js",
      "default": "./dist/posting-streak.js"
    },
    "./scoring": {
      "types": "./dist/scoring.d.ts",
      "browser": "./dist/browser/scoring.js",
      "bun": "./dist/scoring.js",
      "node": "./dist/node/scoring.js",
      "default": "./dist/scoring.js"
    },
    "./social": {
      "types": "./dist/social.d.ts",
      "browser": "./dist/browser/social.js",
      "bun": "./dist/social.js",
      "node": "./dist/node/social.js",
      "default": "./dist/social.js"
    },
    "./types": {
      "types": "./dist/types.d.ts",
      "browser": "./dist/browser/types.js",
      "bun": "./dist/types.js",
      "node": "./dist/node/types.js",
      "default": "./dist/types.js"
    },
    "./validation": {
      "types": "./dist/validation.d.ts",
      "browser": "./dist/browser/validation.js",
      "bun": "./dist/validation.js",
      "node": "./dist/node/validation.js",
      "default": "./dist/validation.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/lib.contracts-spec-core](https://lssm.co/docs/packages/lib.contracts-spec-core/): `workspace:^`
- [@lssm-tech/lib.schema](https://lssm.co/docs/packages/lib.schema/): `workspace:^`

### Peer dependencies

No declarations in the inspected manifest.

### Optional dependencies

No declarations in the inspected manifest.

### Development dependencies

- [@lssm-tech/tool.bun](https://lssm.co/docs/packages/tool.bun/): `workspace:*`
- [@lssm-tech/tool.typescript](https://lssm.co/docs/packages/tool.typescript/): `workspace:*`
- `typescript`: `catalog:`

### Peer dependency metadata

```json
{}
```

### Bundled dependencies

```json
null
```

## Package scripts

Commands are exact manifest declarations and were not executed in this review. Script metadata status: complete pinned manifest.

```json
{
  "build": "contractspec-bun-build build",
  "build:bundle": "contractspec-bun-build transpile",
  "build:types": "contractspec-bun-build types",
  "clean": "rimraf dist .turbo",
  "dev": "contractspec-bun-build dev",
  "lint": "bun lint:fix",
  "lint:check": "node ../../../../scripts/biome.cjs check .",
  "lint:fix": "node ../../../../scripts/biome.cjs check --write .",
  "prebuild": "contractspec-bun-build prebuild",
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
  "test": "bun test",
  "typecheck": "tsgo --noEmit"
}
```

## Declared documentation links

- [Lib Gamification Spec documentation](https://www.npmjs.com/package/%40lssm-tech%2Flib.gamification-spec) — declared link; destination not verified.

```json
{
  "url": "https://www.npmjs.com/package/%40lssm-tech%2Flib.gamification-spec",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/lib.gamification-spec.txt",
  "route": "/llms/lib.gamification-spec",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/lib.gamification-spec.txt",
  "blobSha": "984b00c345bb858c4c6dc601e7292d5a3278ac4a",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
