diff --git a/pygittools/src/pygittools/tasks/__init__.py b/pygittools/src/pygittools/tasks/__init__.py
index f776d0b..38a8ad0 100644
--- a/pygittools/src/pygittools/tasks/__init__.py
+++ b/pygittools/src/pygittools/tasks/__init__.py
@@ -371,6 +371,143 @@ def get_comment(repo: Repository, oid: Oid) -> Comment:
     return c
 
 
+def _normalize_task_ref(task_ref: str) -> str:
+    return task_ref if task_ref.startswith("refs/") else get_task_ref(task_ref)
+
+
+def _as_oid(oid: Oid | str) -> Oid:
+    return Oid(hex=oid) if isinstance(oid, str) else oid
+
+
+def replace_board_task_oid(
+    repo: Repository,
+    board_name: str,
+    old_oid: str,
+    new_oid: Oid | str,
+) -> None:
+    """Replace a task OID on a board after the task tag object was rewritten."""
+    board = get_board(repo, get_board_ref(board_name))
+    if board is None or not getattr(board, "tasks", None):
+        return
+    new_oid_str = str(new_oid)
+    board.tasks = [new_oid_str if entry == old_oid else entry for entry in board.tasks]
+    board.update_message()
+    board.write(repo)
+
+
+def _rewrite_task_comments(
+    repo: Repository,
+    task_ref: str,
+    comments: list[Oid | str],
+    *,
+    board: str | None = None,
+) -> Oid:
+    ref = _normalize_task_ref(task_ref)
+    task = get_task(repo, ref)
+    if task is None:
+        raise KeyError(f"Task not found: {ref}")
+    try:
+        old_task_oid = str(repo.references[ref].resolve().target)
+    except KeyError as exc:
+        raise KeyError(f"Task not found: {ref}") from exc
+    task.comments = comments
+    task.update_message()
+    new_task_oid = task.write(repo)
+    if board is not None:
+        replace_board_task_oid(repo, board, old_task_oid, new_task_oid)
+    return new_task_oid
+
+
+class CreateCommentResult(TypedDict, total=True):
+    oid: Oid
+    comment: Comment
+    task_oid: Oid
+
+
+class ModifyCommentResult(TypedDict, total=True):
+    oid: Oid
+    comment: Comment
+    task_oid: Oid
+
+
+def create_comment(
+    repo: Repository,
+    task_ref: str,
+    content: str,
+    *,
+    tagger: str = "",
+    board: str | None = None,
+) -> CreateCommentResult:
+    """Write a comment, append it to the task, and optionally sync the board OID."""
+    ref = _normalize_task_ref(task_ref)
+    task = get_task(repo, ref)
+    if task is None:
+        raise KeyError(f"Task not found: {ref}")
+    try:
+        target_oid = repo.references[ref].resolve().target
+    except KeyError as exc:
+        raise KeyError(f"Task not found: {ref}") from exc
+    comment = Comment(target=target_oid, tagger=tagger, content=content)
+    comment_oid = comment.write(repo)
+    comments = list(getattr(task, "comments", []) or [])
+    comments.append(str(comment_oid))
+    task_oid = _rewrite_task_comments(repo, ref, comments, board=board)
+    return {"oid": comment_oid, "comment": comment, "task_oid": task_oid}
+
+
+def modify_comment(
+    repo: Repository,
+    comment_oid: Oid | str,
+    content: str,
+    *,
+    task_ref: str,
+    board: str | None = None,
+) -> ModifyCommentResult:
+    """Rewrite comment content and replace its OID in the task's comment list."""
+    old_oid = _as_oid(comment_oid)
+    old_hex = str(old_oid)
+    comment = get_comment(repo, old_oid)
+    ref = _normalize_task_ref(task_ref)
+    task = get_task(repo, ref)
+    if task is None:
+        raise KeyError(f"Task not found: {ref}")
+    comments = list(getattr(task, "comments", []) or [])
+    if old_hex not in {str(entry) for entry in comments}:
+        raise KeyError(f"Comment {old_hex} is not linked to task {ref}")
+    comment.content = content
+    comment.edited_at = datetime.now()
+    comment.update_message()
+    new_oid = comment.write(repo)
+    updated = [str(new_oid) if str(entry) == old_hex else entry for entry in comments]
+    task_oid = _rewrite_task_comments(repo, ref, updated, board=board)
+    return {"oid": new_oid, "comment": comment, "task_oid": task_oid}
+
+
+def delete_comment(
+    repo: Repository,
+    comment_oid: Oid | str,
+    *,
+    task_ref: str,
+    board: str | None = None,
+) -> Oid:
+    """Unlink a comment from its task, delete the comment ref, return the new task OID."""
+    oid = _as_oid(comment_oid)
+    oid_hex = str(oid)
+    comment = get_comment(repo, oid)
+    ref = _normalize_task_ref(task_ref)
+    task = get_task(repo, ref)
+    if task is None:
+        raise KeyError(f"Task not found: {ref}")
+    comments = list(getattr(task, "comments", []) or [])
+    if oid_hex not in {str(entry) for entry in comments}:
+        raise KeyError(f"Comment {oid_hex} is not linked to task {ref}")
+    remaining = [entry for entry in comments if str(entry) != oid_hex]
+    task_oid = _rewrite_task_comments(repo, ref, remaining, board=board)
+    if comment.name in repo.references:
+        repo.references.delete(comment.name)
+    return task_oid
+
+
 class Board:
     """
     A Board is an annotated tag (a full tag object, although it will get a ref as well).
diff --git a/pygittools/src/pygittools/tasks_query.py b/pygittools/src/pygittools/tasks_query.py
index 9e5aaeb..d583194 100644
--- a/pygittools/src/pygittools/tasks_query.py
+++ b/pygittools/src/pygittools/tasks_query.py
@@ -24,6 +24,7 @@ BOARD_STATUS_ORDER: tuple[str, ...] = ("TODO", "IN_PROGRESS", "IN_REVIEW", "DONE
 
 
 class CommentView(TypedDict):
+    oid: str
     content: str
     author: str
     created_at: str | None
@@ -113,8 +114,9 @@ def open_repository(location: RepoLocation | None = None) -> Repository:
     return Repository(str(loc.path))
 
 
-def _comment_to_view(comment: Comment) -> CommentView:
+def _comment_to_view(comment: Comment, oid: Oid | str) -> CommentView:
     return {
+        "oid": str(oid),
         "content": comment.content,
         "author": comment.tagger,
         "created_at": comment.created_at.isoformat() if comment.created_at else None,
@@ -130,8 +132,8 @@ def _load_task_comments(repo: Repository, task: Task) -> list[CommentView]:
             comment = get_comment(repo, oid)
         except (ValueError, KeyError, TypeError):
             continue
-        comments.append(_comment_to_view(comment))
-    comments.sort(key=lambda entry: entry.get("edited_at") or entry.get("created_at") or "")
+        comments.append(_comment_to_view(comment, oid))
+    comments.sort(key=lambda entry: entry.get("created_at") or "")
     return comments
 
 
diff --git a/pygittools/src/pygittools/tasks_query_test.py b/pygittools/src/pygittools/tasks_query_test.py
index 8e2a8a2..92bf405 100644
--- a/pygittools/src/pygittools/tasks_query_test.py
+++ b/pygittools/src/pygittools/tasks_query_test.py
@@ -9,6 +9,8 @@ from pygittools.tasks import (
     Board,
     Comment,
     Task,
+    create_comment,
+    modify_comment,
 )
 from pygittools.tasks_query import (
     get_board_tasks_grouped,
@@ -60,6 +62,7 @@ def test_list_boards_and_tasks_with_comments(repo: Repository) -> None:
     assert tasks[0]["status"] == "IN_PROGRESS"
     assert tasks[0]["comments"] == [
         {
+            "oid": str(comment_oid),
             "content": "Looks good",
             "author": "alice <alice@example.com>",
             "created_at": tasks[0]["comments"][0]["created_at"],
@@ -75,6 +78,50 @@ def test_list_boards_and_tasks_with_comments(repo: Repository) -> None:
     assert columns[1]["tasks"][0]["title"] == "Alpha"
 
 
+def test_task_comments_sorted_by_created_at_after_edit(repo: Repository) -> None:
+    board_ref = f"{BOARD_REF_PREFIX}Tasks"
+    board = Board(_empty_tree(), board_ref, tagger="", description="Main")
+    task = Task(
+        _empty_tree(),
+        f"{TASK_REF_PREFIX}thread",
+        "alice <alice@example.com>",
+        title="Thread",
+        status=Task.Status.TODO,
+    )
+    task_oid = task.write(repo)
+    board.tasks = [str(task_oid)]
+    board.update_message()
+    board.write(repo)
+
+    first = create_comment(
+        repo,
+        "thread",
+        "first",
+        tagger="alice <alice@example.com>",
+        board="Tasks",
+    )
+    second = create_comment(
+        repo,
+        "thread",
+        "second",
+        tagger="bob <bob@example.com>",
+        board="Tasks",
+    )
+    modify_comment(
+        repo,
+        first["oid"],
+        "first edited",
+        task_ref="thread",
+        board="Tasks",
+    )
+
+    comments = get_task_view(repo, "thread")["comments"]
+    assert comments is not None
+    assert [c["content"] for c in comments] == ["first edited", "second"]
+    assert comments[0]["oid"] != str(first["oid"])
+    assert comments[1]["oid"] == str(second["oid"])
+
+
 def test_resolve_task_from_board_entry_follows_current_ref(repo: Repository) -> None:
     task = Task(
         _empty_tree(),
diff --git a/pygittools/src/pygittools/tasks_test.py b/pygittools/src/pygittools/tasks_test.py
index 5ac7254..75fc9eb 100644
--- a/pygittools/src/pygittools/tasks_test.py
+++ b/pygittools/src/pygittools/tasks_test.py
@@ -14,11 +14,14 @@ from pygittools.tasks import (
     Comment,
     Task,
     archive_task_local,
+    create_comment,
+    delete_comment,
     delete_task_local,
     get_board,
     get_comment,
     get_task,
     get_task_by_oid,
+    modify_comment,
 )
 
 TAGGER: str = "alice <alice@example.com>"
@@ -447,3 +450,82 @@ def test_archive_task_local_creates_archive_board_when_missing(repo: Repository)
     assert archive_board is not None
     assert getattr(archive_board, "description", "") == "Archived tasks"
     assert archive_board.tasks == [str(task_oid)]
+
+
+def _seed_board_task(repo: Repository, task_id: str = "c1") -> str:
+    board = Board(_empty_tree(), BOARD_MAIN, TAGGER, description="Main")
+    task = Task(
+        _empty_tree(),
+        _task_ref(task_id),
+        TAGGER,
+        title="Comment task",
+        status=Task.Status.TODO,
+    )
+    task_oid = task.write(repo)
+    board.tasks = [str(task_oid)]
+    board.update_message()
+    board.write(repo)
+    return task_id
+
+
+def test_create_comment_links_task_and_syncs_board(repo: Repository) -> None:
+    task_id = _seed_board_task(repo)
+    result = create_comment(
+        repo,
+        task_id,
+        "hello",
+        tagger="bob <bob@example.com>",
+        board="main",
+    )
+    loaded = get_comment(repo, result["oid"])
+    assert loaded.content == "hello"
+    assert loaded.tagger == "bob <bob@example.com>"
+    task = get_task(repo, _task_ref(task_id))
+    assert task is not None
+    assert task.comments == [str(result["oid"])]
+    board = get_board(repo, BOARD_MAIN)
+    assert board is not None
+    assert board.tasks == [str(result["task_oid"])]
+
+
+def test_modify_comment_replaces_oid_on_task(repo: Repository) -> None:
+    task_id = _seed_board_task(repo, "c2")
+    created = create_comment(repo, task_id, "before", tagger=TAGGER, board="main")
+    modified = modify_comment(
+        repo,
+        created["oid"],
+        "after",
+        task_ref=task_id,
+        board="main",
+    )
+    assert str(modified["oid"]) != str(created["oid"])
+    assert get_comment(repo, modified["oid"]).content == "after"
+    task = get_task(repo, _task_ref(task_id))
+    assert task is not None
+    assert task.comments == [str(modified["oid"])]
+    board = get_board(repo, BOARD_MAIN)
+    assert board is not None
+    assert board.tasks == [str(modified["task_oid"])]
+
+
+def test_modify_comment_rejects_unlinked_oid(repo: Repository) -> None:
+    task_id = _seed_board_task(repo, "c3")
+    create_comment(repo, task_id, "on task", tagger=TAGGER, board="main")
+    orphan = Comment(_empty_tree(), TAGGER, "orphan")
+    orphan_oid = orphan.write(repo)
+    with pytest.raises(KeyError, match="not linked"):
+        modify_comment(repo, orphan_oid, "nope", task_ref=task_id, board="main")
+
+
+def test_delete_comment_unlinks_and_removes_ref(repo: Repository) -> None:
+    task_id = _seed_board_task(repo, "c4")
+    created = create_comment(repo, task_id, "bye", tagger=TAGGER, board="main")
+    comment_ref = get_comment(repo, created["oid"]).name
+    new_task_oid = delete_comment(repo, created["oid"], task_ref=task_id, board="main")
+    task = get_task(repo, _task_ref(task_id))
+    assert task is not None
+    assert task.comments == []
+    assert comment_ref not in repo.references
+    board = get_board(repo, BOARD_MAIN)
+    assert board is not None
+    assert board.tasks == [str(new_task_oid)]
