# Interaction Logger

> Interaction Logger

- Skill: `demerzels-lab/interaction-logger` (Agent Skill, multi-file: 6 files)
- Install (CLI): `npx skillmds@latest add demerzels-lab/interaction-logger`
- Raw SKILL.md: https://api.skillmd.com/api/skills/demerzels-lab/interaction-logger/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Demerzels-lab (https://skillmd.com/u/demerzels-lab)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/demerzels-lab/interaction-logger

---

# Interaction Logger

A robust utility for appending interaction logs to user-specific history files. 
It abstracts away JSON parsing, file I/O, and schema validation.

## Usage

```bash
node skills/interaction-logger/log.js --target <target_alias> --role <role> --content <message>
```

## Arguments

- `--target`: The user alias.
  - `zhy`, `shiqi`, `master` -> `memory/master_history.json`
  - `fmw`, `big-brother` -> `fmw/history.json`
- `--role`: Who is speaking (`user` | `assistant` | `system`). Default: `assistant`.
- `--content`: The text content to log.

## Why use this?
- **Safety**: Prevents JSON syntax errors from manual editing.
- **Convenience**: One-line command vs multi-step read/edit/write.
- **Compliance**: Ensures mandatory logging rules (from MEMORY.md) are actually followed.

## Features
- **Atomic Writes**: Uses `.tmp` file + rename to prevent corruption on crash.
- **Log Rotation**: Automatically rotates log files when they exceed 5MB to `filename_YYYY-MM-DD-HHmmss.json`.
- **Dynamic Targets**: Auto-creates log files for new users in `memory/users/`.

