AgentSkillsCN

os-tk-logging

将运营日志写入 .os-tk/ 目录(记录活动、错误、进度与经验教训)。

SKILL.md
--- frontmatter
name: os-tk-logging
description: Write operational logs to .os-tk/ (activity, errors, progress, lessons).

os-tk-logging

Implements the lightweight logging spec (human-readable, append-only).

Resolve skill dir (for scripts)

bash
SKILL_DIR=".pi/skills/os-tk-logging"
if [[ ! -d "$SKILL_DIR" ]]; then SKILL_DIR="pi/skills/os-tk-logging"; fi

Inputs (required variables)

  • CMD (e.g., os-tk-review, os-tk-done)
  • TICKET_ID, TICKET_ALIAS, CHANGE_ID
  • BRANCH, WORKTREE
  • STATUS (ok or error)

Ensure files

  • bash "$SKILL_DIR/scripts/ensure-files.sh"

activity.log (human-readable)

Start:

  • eval "$(bash "$SKILL_DIR/scripts/activity-start.sh")" → sets START_EPOCH/TS_START

End:

  • eval "$(bash "$SKILL_DIR/scripts/activity-end.sh")" → sets TS_END/DUR_MS

errors.log (append-only)

On failure: set ERROR_MESSAGE, then:

  • bash "$SKILL_DIR/scripts/append-error.sh"

progress.md (append-only)

  • bash "$SKILL_DIR/scripts/append-progress.sh" (requires TS_END, TICKET_ID, TICKET_ALIAS, CHANGE_ID, VERDICT, VERIFICATION_SUMMARY, NEXT_TICKET, BLOCKERS)

Lessons learned (.os-tk/AGENTS.md)

Only append when a new durable lesson is discovered (not a changelog).

Set LESSON, then:

  • bash "$SKILL_DIR/scripts/append-lessons.sh"